?? windowclosing.java
字號:
//WindowClosing.java
import javax.swing.*;
import java.awt.event.*;
public class WindowClosing
{
public static void main(String[] args)
{
SimpleFrame frame = new SimpleFrame();
//設置用戶關閉框架時的響應動作
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
//顯示該框架
frame.show();
}
}
class SimpleFrame extends JFrame
{
public SimpleFrame()
{
//設置框架大小
setSize(WIDTH, HEIGHT);
}
public static final int WIDTH = 300;
public static final int HEIGHT = 200;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -