import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
public class WindowEvent {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Frame f = new Frame("我的awt");
f.setSize(500, 600);
f.setLocation(100, 200);
f.setLayout(new FlowLayout());
Button b = new Button("我的按钮");
f.add(b);
f.addWindowListener(new WindowAdapter()//此处提示:The method windowClosing(WindowEvent) from the type new WindowAdapter(){} is never used locally
{
public void windowClosing(WindowEvent e)
{
System.out.println("wo guan");
System.exit(0);
}
});
f.setVisible(true);
}
}
提示:这是在eclipse中运行的
添加了窗体监听,但是关闭的时候,关闭不了窗口,
大家看看是什么原因
是不是,少了什么东西啊,我看代码正确,包也导了,就是不知道为什么了