📄 test.java
字号:
import java.awt.*;
import java.awt.event.*;
public class Test extends Frame implements WindowListener
{
TextField t=new TextField();
Test()
{
this.addWindowListener(this);
this.add(t,BorderLayout.NORTH);
this.setSize(400,400);
this.setVisible(true);
}
public static void main(String args[])
{
Test my=new Test();
}
public void windowOpened(WindowEvent e) {
// TODO: Add your code here
}
public void windowClosing(WindowEvent e) {
// 在这里关闭窗口
this.dispose();//释放窗口对象
}
public void windowClosed(WindowEvent e) {
System.out.println("窗口已经关闭");
}
public void windowIconified(WindowEvent e) {
// TODO: Add your code here
}
public void windowDeiconified(WindowEvent e) {
// TODO: Add your code here
}
public void windowActivated(WindowEvent e) {
// TODO: Add your code here
}
public void windowDeactivated(WindowEvent e) {
// TODO: Add your code here
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -