2
I need to ask if I want to close the window that is open. I made the following form, but in any of the options, it closes. I currently use this event option:
private void formWindowClosing(java.awt.event.WindowEvent evt) {
if (JOptionPane.showConfirmDialog(null, "Você deseja realmente fechar essa janela? Todas mensagens serão perdidas") != JOptionPane.YES_NO_OPTION)
{
this.setVisible(false);
}
}
This is a second form, I have the main one, with the options and I have the second one, where I ask if you really want to close. It is a Jframe.
Another detail is that in the message displayed there are 3 options: YES, NO and CANCEL. I only want the two options YES and NO.
Related: How do I make a treatment of Joptionpane.showMessageDialog options()?
– Math