📄 windoweventdemo.java
字号:
import java.awt.*;import java.awt.event.*;public class WindowEventDemo extends Frame { public WindowEventDemo() {/* The Frame registers a WindowListener. */ addWindowListener(new WinAdapter()); setBounds(100, 100, 300, 200); setVisible(true); } public static void main(String args[]) { WindowEventDemo demo = new WindowEventDemo(); }}/* This WindowListener does not need access to the private data *//* members of the WindowEventDemo class (if there were any), so *//* it can be implemented as a separate class that extends the *//* WindowAdapter class. The windowClosing() method is overridden *//* to terminate the program if the window is closed. */class WinAdapter extends WindowAdapter{ public void windowClosing(WindowEvent event) { System.exit(0); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -