package asdfghjkl;
import java.awt.*;
import java.awt.event.*;
public class asdf {
public static void main(String[] args) {
Frame f=new Frame("我的窗体!");
f.setSize(400,300);
f.setLocation(300,200);
f.setVisible(true);
MyWindowListener mw=new MyWindowListener();
f.addWindowListener(mw);
}
}
class MyWindowListener implements WindowListener{
public void windowClosing(WindowEvent e) {
Window window = e.getWindow();
window.setVisible(false);
window.dispose();
}
public void windowActivated(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowOpened(WindowEvent e) {
}
}
作者:温柔仅仅对她
链接:https://www.jianshu.com/p/e8f6abb1c55a
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。