当前位置: 代码迷 >> Java相关 >> 关于pocessWindowEvent(WindowEvent e)
  详细解决方案

关于pocessWindowEvent(WindowEvent e)

热度:324   发布时间:2008-03-28 21:48:23.0
关于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]]
搜索更多相关的解决方案: WindowEvent  import  java  awt  public  

----------------解决方案--------------------------------------------------------