?? 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 + -