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

📄 servermainframe.java

📁 一套基于JAVA开发的完整版航空订票系统,代码简洁,适合JAVA初学者研究
💻 JAVA
字号:
package com.tarena.abs.server;

import javax.swing.*;

import java.awt.event.*;

public class ServerMainFrame extends JFrame implements ActionListener{
	private static final long serialVersionUID = -3991263007397302453L;
	private JMenuBar jmb;
	private JMenu flight,agent,order,info;
	public ServerMainFrame(){
		super("航班机票预定系统--服务器端主界面");
		jmb=new JMenuBar();
		flight=new JMenu("航班管理");
		agent=new JMenu("代理商管理");
		order=new JMenu("订单管理");
		info=new JMenu("系统信息");
		init();
	}
	
	private void init(){
		JMenuItem item;
		flight.add(item=new JMenuItem("添加航班计划"));item.addActionListener(this);
		flight.add(item=new JMenuItem("删除航班计划"));item.addActionListener(this);
		flight.add(item=new JMenuItem("查询航班计划"));item.addActionListener(this);
		flight.add(item=new JMenuItem("添加飞机型号"));item.addActionListener(this);
		flight.add(item=new JMenuItem("添加航班"));item.addActionListener(this);
		flight.add(item=new JMenuItem("退出"));item.addActionListener(this);
		
		agent.add(item=new JMenuItem("添加代理商"));item.addActionListener(this);
		agent.add(item=new JMenuItem("删除代理商"));item.addActionListener(this);	
		agent.add(item=new JMenuItem("在线代理商信息"));item.addActionListener(this);
		agent.add(item=new JMenuItem("注册代理商信息"));item.addActionListener(this);
		
		order.add(item=new JMenuItem("查看订单"));item.addActionListener(this);
		order.add(item=new JMenuItem("业绩统计"));item.addActionListener(this);
		
		info.add(item=new JMenuItem("制作信息"));item.addActionListener(this);
		info.add(item=new JMenuItem("帮助文档"));item.addActionListener(this);
		
		jmb.add(flight);
		jmb.add(agent);
		jmb.add(order);
		jmb.add(info);
		this.setJMenuBar(jmb);
	}
	public void showMe(){
		this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		this.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e) {
				askQuit();
			}	
		});
		this.setSize(1000,600);
		this.setVisible(true);
	}
	private void askQuit(){
		int choice=JOptionPane.showConfirmDialog(this,"退出服务器将中断网络连接,是否确定退出?","确定退出?",
				JOptionPane.YES_NO_CANCEL_OPTION);
		switch(choice){
			case JOptionPane.OK_OPTION : System.exit(0);
			case JOptionPane.NO_OPTION :return;
			case JOptionPane.CANCEL_OPTION : return;
		}
	}
	public void actionPerformed(ActionEvent e) {
		String command=e.getActionCommand();
		if(command.equals("添加航班计划")){
			new AddFlightSchedularDialog(this).showMe();
		}
		if(command.equals("删除航班计划")){
			new RemoveFlightSchedularDialog(this).showMe();
		}
		if(command.equals("查询航班计划")){
			new SearchFlightSch(this);
		}
		if(command.equals("添加飞机型号")){
			new AddPlaneModelDialog(this).showMe();
		}
		if(command.equals("添加航班")){
			new AddFlight(this);
		}
		if(command.equals("退出")){
			askQuit();
		}if(command.equals("添加代理商")){
			new AddAgentDialog(this).showMe();
		}if(command.equals("删除代理商")){
			new MyRemoveAgent(this).showMe();
		}if(command.equals("注册代理商信息")){
			new MyShowAllAgent(this);
		}if(command.equals("在线代理商信息")){
			new MyAllOnlineAgent(this);
		}if(command.equals("查看订单")){
			new MyShowOrder(this);
		}if(command.equals("业绩统计")){
			new MyShowScore(this);
		}if(command.equals("帮助文档")){
			new MyShowHelp(this);
		}if(command.equals("制作信息")){
			new MyShowMySelf(this);
		}
		
	}
}

⌨️ 快捷键说明

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