I want to show the "Confirm Close" window when closing the main application window, but without it disappearing. Right now I am using a windowsListenermore specific event windowsClosing, but when using this event, the main window closes, and I want it to be open.
Here is the code I'm using:
To register a listener
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
thisWindowClosing(evt);
}
});
Implementation of the processing event:
private void thisWindowClosing(WindowEvent evt) {
new closeWindow(this);
}
I also tried using this.setVisible(true)in the method thisWindowClosing(), but it does not work.
Any suggestions?
testk source
share