
using swing i want to give an exit button which on clicking ask a msg "JOptionPane" is select "yes" then it should exit or else not....plez help me......
JOptionPane.showConfirmDialog(null,"DO YOU REALLY WANT TO EXIT"); System.exit(0);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
int i=JOptionPane.showConfirmDialog(null,"DO YOU REALLY WANT TO EXIT");
if(i==0)
{
// this.setVisible(false);
System.exit(0);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.