I would like to ask click on an "OK" button ( button_OK
) to ask me if I'm sure to perform "x" action.
If I strike YES - > Code to be made ...
If I strike NO - > The JOptionPane
is closed and I return to the window of the same button_OK
Code :
private void button_OKActionPerformed(java.awt.event.ActionEvent evt) {
Conexiones.cargar(valor, entero);
//Cerramos el JDialog actual.
dispose();
//Cargamos el JDialog de compra y lo hacemos visible para interactuar con él.
Compra c = new Compra(null, true);
c.setVisible(true);
}
I would like something similar to the closing of a window in Java, whose code is as follows:
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent evt){
if (JOptionPane.showConfirmDialog(rootPane, "¿Desea salir de la aplicación?",
"Salir de la aplicación", JOptionPane.ERROR_MESSAGE) == JOptionPane.ERROR_MESSAGE){
System.exit(0);
}
}
});