如何检查JFrame
窗口何时关闭?
MediaPanel mediaPanel=new MediaPanel();
JFrame_of_subtitle frame=new JFrame_of_subtitle(mediaPanel);
JPanel panel=new JPanel();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
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.