I have a Swing UI with certain number of buttons. One button invokes a separate swing class and a new window is opened with new buttons and other features. Now when I am closing this window the original window is also getting closed.
I think this is because both the classes have impemented
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
//some code
}
}
Now how to overcome this? A code example or link will be very helpful.
Thanks
It is hard to guess without seeing the code. Perhaps your
JFramehassetDefaultCloseOperationset to close the application when the window is closed (maybeEXIT_ON_CLOSE). Have a look at the java doc for more info on this.From the java doc:
This means that the whole application will close. You do not want that for the second window. You just want the window (not the application) to close.