本帖最后由 赵晓东 于 2013-4-2 22:39 编辑
- import java.awt.*;
- import java.awt.event.*;
- class GuiDemo
- {
- public static void main(String[] args)
- {
- Frame c = new Frame("My AWT");
- Button b = new Button("我是一个按钮");
- c.add(b);
- c.setLayout(new FlowLayout());
- c.setVisible(true);
- c.setSize(500,400);
- c.setLocation(300,200);
- c.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowEvent e)
- {
- System.out.println("It's my close");
- System.exit(0);
- }
- public void windowActivated(WindowEvent e)
- {
- System.out.println("It's my life!");
- }
- public void windowOpened(WindowEvent e)//windows7 不可用
- {
- System.out.println("it's my open!");
- }
- });
- }
- }
复制代码 windowOpened(WindowEvent e)方法没有显示作用 |