//some 3rd party need geo

Java problem - dispose()

  Dougie168 17:09 15 Apr 06
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();
}
});

  Dougie168 17:17 15 Apr 06

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

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

What is Google Allo? What is Google Duo? Google Allo UK release date rumours and features: Google…

1995-2015: How technology has changed the world in 20 years

These clever designs help visualise a complex intelligence tool

iOS 10 troubleshooting tips: Simple fixes for the most common iOS 10 problems, from network…