📄 windowclosing.java
字号:
import javax.swing.*;
import java.awt.event.*;
public class WindowClosing{
public static void main(String[] args) {
JFrame frame = new JFrame();
//设置用户关闭框架时的响应动作
frame.addWindowListener(new QuitWindow());
frame.setSize(200,300);
frame.show(); //显示该框架
}
}
class QuitWindow implements WindowListener
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public void windowOpened(WindowEvent e) {}
public void windowClosed(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 + -