test.java

来自「该压缩文件中共包含16个非常实用的java学习实例」· Java 代码 · 共 58 行

JAVA
58
字号
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 + =
减小字号Ctrl + -
显示快捷键?