问题
How do I check when JFrame
window is closed?
MediaPanel mediaPanel=new MediaPanel();
JFrame_of_subtitle frame=new JFrame_of_subtitle(mediaPanel);
JPanel panel=new JPanel();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
回答1:
You will add WindowListener to your frame.
WindowListener has a windowClosing callback function which will be invoked when your frame is being closed.
You can see this tutorial for sample code.
来源:https://stackoverflow.com/questions/10370064/how-can-i-check-when-a-jframe-has-been-closed