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