- import java.awt.*;
- import java.awt.event.*;
- class AwtDemo
- {
- public static void main(String[] args)
- {
- Frame f = new Frame("my awt");
- f.setSize(500,400);
- f.setLayout(new FlowLayout());
- f.setVisible(true);
- f.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowEvent e)
- {
- System.out.println("我关");
- System.exit(0);
- }
- public void windowOpened(WindowEvent e)
- {
- System.out.println("我被打开啦.........");
- }
- public void windowActivated(WindowEvent e)
- {
- System.out.println("我开启啦");
- }
- });
- }
- }
复制代码 public void windowOpened(WindowEvent e)
{
System.out.println("我被打开啦.........");
}
为什么这句我运行时没打印出结果? |