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

📄 fifthwindow.java

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

  public FifthWindow() // a constructor
  {
    mainFrame = new JFrame("Fifth GUI Window");

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

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

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

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

⌨️ 快捷键说明

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