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

📄 useroptions.java

📁 一个飞机调度员模拟训练程序,可以添加跑道数量,控制飞机飞行的速度.默认的密码可以在AtcSystem类里面修改,其中内置了三个用户名.这套系统是我和几个国外同学合力开发的,希望对大家有帮助
💻 JAVA
字号:
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
/**
 * Write a description of class System here.
 * 
 * Adam Lilley 
 * 5/3/07
 */
public  class UserOptions implements ActionListener
{

    private static UserOptions singleton;

    private JButton ok;
    private JButton cancel;
    private JButton logout; 
    private JButton chooseLevel; 
    private JButton results;
    
    private JButton editLevel; 
    private JButton viewReports;
    private JButton manageUsers;
    private JButton startLevel;
    
    
    
    private JFrame frame;
    
    

    private SpringLayout layout = new SpringLayout();
    
    public UserOptions()
    {
         frame = new JFrame();
         frame.setSize(800,600);
         
         Container content = frame.getContentPane();
         content.setLayout(layout);
        
         logout = new JButton("Log out");
         content.add(logout);
        
         cancel = new JButton("Exit");
         content.add(cancel);
        
        
         JLabel welcomeLabel = new JLabel("Options");
         welcomeLabel.setFont(new Font(null,Font.BOLD,32)); 
         content.add(welcomeLabel);
        
         chooseLevel = new JButton("  Select level ");
         content.add(chooseLevel);
        
         viewReports = new JButton("View Results");
         content.add(viewReports);
        
         cancel.addActionListener(this);
         logout.addActionListener(this);
         chooseLevel.addActionListener(this);
         viewReports.addActionListener(this);
         
         layout.putConstraint(SpringLayout.NORTH, cancel, 500, SpringLayout.NORTH, content);
         layout.putConstraint(SpringLayout.EAST, cancel, -50, SpringLayout.EAST, content);
         layout.putConstraint(SpringLayout.EAST, logout, -20, SpringLayout.WEST, cancel);
         layout.putConstraint(SpringLayout.NORTH, logout, 0, SpringLayout.NORTH, cancel);
         
         layout.putConstraint(SpringLayout.WEST, chooseLevel, 350, SpringLayout.WEST, content);
         layout.putConstraint(SpringLayout.NORTH, chooseLevel, 200, SpringLayout.NORTH, content);
         
         layout.putConstraint(SpringLayout.EAST, viewReports, 0, SpringLayout.EAST, chooseLevel);
         layout.putConstraint(SpringLayout.NORTH, viewReports, 20, SpringLayout.SOUTH, chooseLevel);
         
         layout.putConstraint(SpringLayout.WEST, welcomeLabel, 350, SpringLayout.WEST, content);
         layout.putConstraint(SpringLayout.NORTH, welcomeLabel, 100, SpringLayout.NORTH, content);
         
        
         frame.setTitle("Options");
         
         makeVisible();
        
     }
     
    public void makeVisible()
    {
        frame.setVisible(true);
        frame.setResizable(false);  
        frame.setLocationRelativeTo(null);
    }
    
    public static void show()
    {
        if (!(singleton == null)) { singleton.makeVisible(); } else { singleton = new UserOptions(); }
    }
     
     public void actionPerformed(ActionEvent event) {
 
       
        
        if (event.getSource().equals(cancel)) { System.exit(0);frame.setVisible(false); }
        if (event.getSource().equals(chooseLevel)) { SelectLevels.show();frame.setVisible(false); }
        if (event.getSource().equals(viewReports)) { UserResults.show(); frame.setVisible(false);}
        if (event.getSource().equals(logout)) {ATCSystem.show(); frame.setVisible(false);}
        


    }
}

⌨️ 快捷键说明

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