📄 appletframe.java
字号:
//Copyright (c) 1998, Arthur Gittleman
//This example is provided WITHOUT ANY WARRANTY either expressed or implied.
/* Shows the use of a Frame as a top-level
* window. Each window event causes the
* applet to display a message in the console.
*/
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class AppletFrame extends Applet
implements WindowListener {
private Frame f;
public void init() {
f = new Frame("MyFrame");
f.setSize(150,150);
f.show();
f.addWindowListener(this);
}
public void windowActivated(WindowEvent evt) {
System.out.println("Activated");
}
public void windowDeactivated(WindowEvent evt) {
System.out.println("Deactivated");
}
public void windowClosed(WindowEvent event) {
System.out.println("Closed");
}
public void windowDeiconified(WindowEvent event) {
System.out.println("Deiconified");
}
public void windowIconified(WindowEvent event) {
System.out.println("Iconified");
}
public void windowOpened(WindowEvent event) {
System.out.println("Opened");
}
public void windowClosing(WindowEvent event) {
System.out.println("Closing");
f.setVisible(false);
f.dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -