0
WindowListener
是一个接口?但是,如何实例化是有效的,如下所示?我们不能实例化接口吗?是否有效实例化windowListener接口?
WindowListener l1=new WindowListener() {
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
};
请参阅[*如何编写窗口监听器*](http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html) – trashgod