本帖最后由 FFF 于 2013-12-12 22:33 编辑
为什么windowOpened没有触发成功?没有打印出Open来?
代码:
- public static void main(String[] args) {
- Frame fa = new Frame("my awt");
- fa.setSize(600, 500);
- fa.setLocation(380, 130);
- fa.setLayout(new FlowLayout());
- Button bu = new Button("窗体");
- fa.add(bu);
- fa.setVisible(true);
- fa.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- System.out.println("Close");
- System.exit(0);
- }
- public void windowActivated(WindowEvent e) {
- System.out.println("焦点");
- }
- public void windowOpened(WindowEvent e) {// 为什么这里没有触发成功没有打印Open
- System.out.println("Open");
- }
- });
- }
复制代码
|
|