📄 myframecanexit.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 + -