windoweventtest.java

来自「java课程的资料以及实验的代码」· Java 代码 · 共 45 行

JAVA
45
字号
import java.awt.*;
import java.awt.event.*;

public class WindowEventTest extends Frame implements WindowListener{
	public WindowEventTest()
	{
		addWindowListener(this);
	}
  public static void main(String args[]){
    WindowEventTest test=new WindowEventTest();
    //test.addWindowListener(test);//自己设置自己一个WindowListener组件
    test.setSize(300,200);
    test.setVisible(true);
  }
  
  public void windowActivated(WindowEvent e)
  {
  }

  public void windowClosed(WindowEvent e)
  {
  }
  
  public void windowClosing(WindowEvent e)
  {
    System.exit(0);
  }

  public void windowDeactivated(WindowEvent e)
  {
  }
  
  public void windowDeiconified(WindowEvent e)
  {
  }

  public void windowIconified(WindowEvent e)
  {
  }

  public void windowOpened(WindowEvent e)
  {
  }
}
  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?