Java problem - dispose()

  [DELETED] 17:09 15 Apr 2006
Locked

help!!
I have a pop up window via a JOptionPane asking the user whether they really want to quit the existing system. As in the code, if the user does not choose the yes option then it should "dispose()" the pop up window but still keep the existing main window .. but when i run it it quits the whole system altogether. Any ideas?

this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent attemptClose)
{
int check = JOptionPane.showConfirmDialog(null,
"Are you sure you want to quit ?", null,
JOptionPane.YES_NO_OPTION);

if (check == JOptionPane.YES_OPTION)
System.exit(0);
else
dispose();
}
});

  [DELETED] 17:17 15 Apr 2006

do i need a setVisible(true)..??

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Microsoft Surface Book 2 15in review

Illustrator Amy Grimes on how setting up her own eco-brand led to success with clients too

MacBook Pro keyboard issues and other problems

Test : l’enceinte connectée HomePod d’Apple