我写了一个程序:
import java.awt.*;
import java.awt.event.*;
class W implements WindowListener{
Frame f;
Button b;
public static void main(String[] args){
W w=new W();
}
W(){
f=new Frame("george");
b=new Button("run");
f.addWindowListener(this);
f.setVisible(true);
}
public void windowClosing(WindowEvent e){
System.out.println("windowclosing");
}
public void windowOpened(WindowEvent e){
System.out.println("windowopened");
}
public void windowIconified(WindowEvent e){
System.out.println("windowIconified");
}
public void windowDeiconified(WindowEvent e){
System.out.println("windowDeiconified");
}
public void windowClosed(WindowEvent e){
System.out.println("windowclosed");
}
public void windowActivated(WindowEvent e){
System.out.println("windowActivated");
}
public void windowDeactivated(WindowEvent e){
System.out.println("windowdeactivated");
}
}
执行程序时,我点击窗口的关闭按钮,只输出windowclosing,我怎么弄才能调用windowclosed()方法
请教了!!