appletframe.java
来自「Java 入门书的源码」· Java 代码 · 共 46 行
JAVA
46 行
//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 + =
减小字号Ctrl + -
显示快捷键?