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

📄 servermainframe.java

📁 航空售票系统的代码
💻 JAVA
字号:
package com.tarena.abs.server;

import java.awt.*;

import javax.swing.*;
import java.awt.event.*;
import com.tarena.abs.dao.*;
import com.tarena.abs.model.*;
import java.io.*;
import java.net.*;
import java.util.*;

public class ServerMainFrame extends JFrame implements ActionListener{
	private JMenuBar jmb;
	private JMenu flight,agent,order,info;
	private SearchPanel center,tempPanel;
//	private JScrollPane center;
//	private JTable table;
	
	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);
		order.add(item=new JMenuItem("业绩统计"));item.addActionListener(this);
		
		info.add(item=new JMenuItem("制作信息"));item.addActionListener(this);
		info.add(item=new JMenuItem("call me"));item.addActionListener(this);
		
		jmb.add(flight);
		jmb.add(agent);
		jmb.add(order);
		jmb.add(info);
		this.setJMenuBar(jmb);
		
		
	}
	//设置主界面的中心JScrollpanel的jtable
	public void setCenterPanel(String msg,ArrayList arr){
		if(center==null){
			center=new SearchPanel(msg,arr);
			this.add(center,BorderLayout.CENTER); 
			this.setVisible(true);
		}else{
			center.setMsg(msg);
			center.setArr(arr);
		}
	  
	}
	
	public void showMe(){
		this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		this.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e) {
				askQuit();
			}	
		});
		this.setSize(800,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).showMe();
		}
		if(command.equals("添加飞机型号")){
			new AddPlaneModelDialog(this).showMe();
		}
		if(command.equals("添加航班")){
			new AddFlight(this);
		}
		if(command.equals("退出")){
			askQuit();
		}
		
		//网点业务
		if(command.equals("添加营业网点")){
			new AddBranchDialog(this).showMe();
		}if(command.equals("删除营业网点")){
			new RemoveBranchDialog(this).showMe();
		}
		if(command.equals("查询所有营业网点信息")){
			new SearchAllBranchs().start();
		}
		
		//订单业务
		if(command.equals("查看所有订单")){
			new SearchAllOrder().start();
		}
		if(command.equals("查看营业网点订单")){
			new SearchOrderFromBranch(this).showMe();
		}
		
		
		if(command.equals("制作信息")){
			StringBuffer sb = new StringBuffer();
			sb.append("      中国国际航空公司订票系统\n");
			sb.append("          (数据库版)\n");
			sb.append("         开发者:周楷\n");
			sb.append("        版本号:airline8.0\n");
			JOptionPane.showMessageDialog(this, sb);
		}
		if(command.equals("call me")){
			StringBuffer sb = new StringBuffer();
			sb.append("                周楷  \n");
			sb.append("            河南  开封\n");
			sb.append("        手机:15810749228\n");
			sb.append("         QQ:358545592\n");
			sb.append("    email:2008zkapie@163.com\n");
			JOptionPane.showMessageDialog(this, sb);
		}
	}
}

⌨️ 快捷键说明

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