import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test extends JFrame{
Wdmb mb=null;
public static void main(String[] args){
Test lx=new Test();
}
public Test(){
mb=new Wdmb();
this.add(mb);
this.addWindowListener(mb);
this.setSize(300,260);
this.setLocation(300,280);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
class Wdmb extends JPanel implements WindowListener{
public void paint(Graphics g){
super.paint(g);
}
public void windowOpened(WindowEvent e){
System.out.println("窗口打开");
}
public void windowClosing(WindowEvent e) {
System.out.println("窗口关闭");
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
System.out.println("最小化");
}
public void windowDeiconified(WindowEvent e) {
System.out.println("从最小化变成正常");
}
public void windowActivated(WindowEvent e) {
System.out.println("窗口被激活");
}
public void windowDeactivated(WindowEvent e) {
}
}
}