package test;
import java.awt.*;
import java.awt.event.*;
public class Example08 {
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();
}
@Override
public void windowActivated(WindowEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void windowClosed(WindowEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void windowIconified(WindowEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void windowOpened(WindowEvent e) {
// TODO 自动生成的方法存根
}
}