llcy 发表于 2008-3-28 21:48

关于pocessWindowEvent(WindowEvent e)

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;

public class JFrame1 extends JFrame {
   
    /** Initialization method that will be called after the applet is loaded
     *  into the browser.
     */
    public JFrame1(){
            setSize(300,300);
            setTitle("try to use processwindowEvent");
    }
    public static void main(String[] args){
            JFrame1 jframe1 = new JFrame1();
            jframe1.setVisible(true);
    }
    protected void processWindowEvent(WindowEvent e){
            if(e.getID()== WindowEvent.WINDOW_CLOSING){
                    System.exit(0);
            }
            else if(e.getID()== WindowEvent.WINDOW_ICONIFIED){
                    this.setIconImage(new ImageIcon("middl.gif").getImage());
            }
            else if(e.getID()== WindowEvent.WINDOW_DEICONIFIED){
                    this.setIconImage(null);
            }
    }

}
那位大哥,好心人帮我看一下`
为什么监听不到关闭事件啊` 怎么不能终止当前正在运行的 Java 虚拟机.点了关闭按钮没有反映啊.

[[it] 本帖最后由 llcy 于 2008-3-28 22:09 编辑 [/it]]


页: [1]

编程论坛