为什么,当我点击关闭窗口时,控制台没动静??- import java.awt.*;
- import java.awt.event.*;
- class AwtDemo{
- public static void main(String[] args){
- Frame f=new Frame("my awt");
- f.setVisible(true);
- f.setSize(200,300);
- f.setLayout(new FlowLayout());
- f.setLocation(300,100);
- Button b=new Button();
- f.add(b);
- f.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowListener e)
- {
- System.out.println("我关");
- System.exit(0);
- }
-
- }
- );
- }
- }
复制代码 |