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

📄 info_server.java

📁 《Java程序设计实践教程》代码
💻 JAVA
字号:
/***************************************************
*  程序文件名称: Info_server.java
*  功能:显示用户操作窗口界面
***************************************************/
import java.awt.*;
import java.awt.event.*;

public class Info_server extends Frame 
{
    TextArea info;
    RunServer server;
    
    public static void main(String[] args)
     {
        // Create application frame.
        Info_server frame = new Info_server();
        // Show frame
        frame.setVisible(true);
     }
    
     public Info_server() 
      {          
        MenuBar menuBar = new MenuBar();
        Menu menuFile = new Menu();
        MenuItem menuFileExit = new MenuItem();
        info = new TextArea("Start Server...");
        
        menuFile.setLabel("System");
        menuFileExit.setLabel("Exit");
        info.setFont(new Font("Default",Font.BOLD,30));
        info.setEditable(false);
        // Add action listener.for the menu button
        menuFileExit.addActionListener
        (
         new ActionListener()
          {
           public void actionPerformed(ActionEvent e)
            {
              Info_server.this.windowClosed();
            }
          }
        ); 
        menuFile.add(menuFileExit);
        menuBar.add(menuFile);
        this.add(info);
        setTitle("Info_server");
        setMenuBar(menuBar);
        setSize(new Dimension(400, 400));
        
        // Add window listener.
        this.addWindowListener
        (
          new WindowAdapter()
           {
            public void windowClosing(WindowEvent e)
             {
                Info_server.this.windowClosed();
              }
            }
        );  
        
        server = new RunServer(info);
        server.start();
    }
    
    /**
     * Shutdown procedure when run as an application.
     */
    protected void windowClosed()
     {	
    	// TODO: Check if it is safe to close the application
        // Exit application.
        System.exit(0);
     }    
}

⌨️ 快捷键说明

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