I have a Java project.
I have a JFrame with a handler attached to it like so
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
this.setEnabled(true);
}
});
But, on that frame I also have a close button (to make it more user friendly) and that "close" button calls the frame dispose method. Now, when I close the frame by clicking the little x button on the top right corner, the WindowListener is called. But the event doesn't fire when I invoke the dispose method.
should I Invoke some other method to close, so the WindowListener fires, or maybe implement another listener?
windowClosed
, the window is already gone when the handler is called. Keep this in mind when you want to cleanup some resources (OpenGL context ...), aswindowClosed
may be already too late for this. – Uveitis