I have a Java project.
I have a JFrame with a handler attached to it, so that
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
this.setEnabled(true);
}
});
But on this frame, I also have a close button (to make it more convenient for the user), and the close button calls the frame removal method. Now, when I close the frame by clicking the small x button in the upper right corner, the WindowListener is called. But the event does not fire when the dispose method is called.
should I call some other method to close, so that the WindowListener fires, or perhaps implements another listener?
source
share