⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowtest.java

📁 这个是Java的swing相关的典型的源码
💻 JAVA
字号:
//Demonstrating the WindowListener  
 
 

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;

public class WindowTest {
  public static void main(String args[]) {
    JFrame frame = new JFrame("Window Listener");
    WindowListener listener = new WindowListener() {
      public void windowActivated(WindowEvent w) {
        System.out.println(w);
      }

      public void windowClosed(WindowEvent w) {
        System.out.println(w);
      }

      public void windowClosing(WindowEvent w) {
        System.out.println(w);
        System.exit(0);
      }

      public void windowDeactivated(WindowEvent w) {
        System.out.println(w);
      }

      public void windowDeiconified(WindowEvent w) {
        System.out.println(w);
      }

      public void windowIconified(WindowEvent w) {
        System.out.println(w);
      }

      public void windowOpened(WindowEvent w) {
        System.out.println(w);
      }
    };
    frame.addWindowListener(listener);
    frame.setSize(300, 300);
    frame.show();
  }
}


           
        

⌨️ 快捷键说明

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