⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myframecanexit.java

📁 java中awt应用的例子
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
	
public class MyFrameCanExit extends Frame implements WindowListener {
	public static void main(String args[ ]){
		MyFrameCanExit fr = new MyFrameCanExit("Hello !");
		fr.addWindowListener(fr);   //注册窗口事件监听器。
		fr.setSize(200,200);				
		fr.setBackground(Color.green);      
		fr.setVisible(true);				
	}
		  
	public MyFrameCanExit(String str){
		super(str);
	}
	
	public void windowClosing(WindowEvent e) { 
    	System.exit(0);
    }

    public void windowClosed(WindowEvent e) { }
    public void windowOpened(WindowEvent e) { }
    public void windowIconified(WindowEvent e) { }
    public void windowDeiconified(WindowEvent e) { }
    public void windowActivated(WindowEvent e) { }
    public void windowDeactivated(WindowEvent e) { }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -