I got an example of JPanel from the Oracle tutorials
I see it uses a default method to close the window
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
what I want is the act of closing the window when clicking the close button, to trigger another method.
How can I do that?
See: http://docs.oracle.com/javase/7/docs/api/java/awt/event/WindowListener.html#windowClosing%28java.awt.event.WindowEvent%29