I have a simple GUI:
public class MyGUI extends JFrame{
public MyGUI(){
run();
}
void run(){
setSize(100, 100);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// maybe an action listener here
}
}
I would like to print out this message:
System.out.println("Closed");
When the GUI is closed (when the X is pressed). How can I do that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…