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

📄 fourthwindow.java

📁 《A first book of java》by Gary J.Bronson 北大出版社
💻 JAVA
字号:
import javax.swing.*;
import java.awt.event.*;
public class FourthWindow extends JFrame
{
  private JFrame mainFrame;

  public FourthWindow() // a constructor
  {
    mainFrame = new JFrame("Fourth GUI Window");

   
    mainFrame.setSize(300,150);
    mainFrame.show();

     // create and register the handler in one statement
    mainFrame.addWindowListener(new WinHandler()); 
  } 

  public static void main(String args[])
  {
    new FourthWindow(); 
  }
}  // end of GUI class

  // extend an adapter class to handle window events
class WinHandler extends WindowAdapter
{
  public void windowClosing(WindowEvent e) {System.exit(0);}
}  // end of listener class  

⌨️ 快捷键说明

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