9.12-testwindowevent.java
来自「介绍有关java的资料 课件 相当一本书籍 里面都是很基础的知识」· Java 代码 · 共 68 行
JAVA
68 行
// TestWindowEvent.java: Create a frame to test window events
import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame;
public class TestWindowEvent extends JFrame
implements WindowListener
{
// Main method
public static void main(String[] args)
{
TestWindowEvent frame = new TestWindowEvent();
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Test Window Event");
frame.setSize(100, 80);
frame.setVisible(true);
}
// Default constructor
public TestWindowEvent()
{
super();
addWindowListener(this); // Register listener
}
public void windowDeiconified(WindowEvent event)
{
System.out.println("Window deiconified");
}
public void windowIconified(WindowEvent event)
{
System.out.println("Window iconified");
}
public void windowActivated(WindowEvent event)
{
System.out.println("Window activated");
}
public void windowDeactivated(WindowEvent event)
{
System.out.println("Window deactivated");
}
public void windowOpened(WindowEvent event)
{
System.out.println("Window opened");
}
public void windowClosing(WindowEvent event)
{
System.out.println("Window closing");
}
public void windowClosed(WindowEvent event)
{
System.out.println("Window closed");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?