import java.awt.event.*;
class MyListener implements WindowListener{
public void windowDeactivated(WindowEvent we){
//做当前窗口变为非活动状态的事
}
public void windowActivated(WindowEvent we){
//做当前窗口变为活动状态时的事
}
public void windowClosed(WindowEvent we){
//做窗口关闭了以后的事
}
public void windowClosing(WindowEvent we){
//做窗口正在关闭时的事
}
public void windowDeiconified(WindowEvent we){
//做窗口还原时的事
}
public void windowIconified(WindowEvent we){
//做窗口最小化时的事
}
public void windowOpened(WindowEvent we){
//做窗口第一次被打开时做的事
}
}
//这是实现接口的方法,如果觉得麻烦,可以继承自WindowAdapter