Java+Swing+Mysql实现飞机订票系统

一、系统介绍

1.开发环境

操作系统:Win10

开发工具 :Eclipse2021

JDK版本:jdk1.8

数据库:Mysql8.0

2.技术选型

Java+Swing+Mysql

3.功能模块

4.数据库设计

1.用户表(users)

字段名称

类型

记录内容

是否为空

备注

u_id

Varchar2(20)

用户名

0

主键

u_password

Varchar2(20)

密码

0

u_name

Varchar2(20)

用户姓名

1

u_telephone

Varchar2(20)

手机号码

1

u_address

Varchar2(100)

用户地址

1

u_email

Varchar2(20)

Email

1

u_idcard

Varchar2(20)

身份证

1

u_power

number

权限

1

1表示机场人员

0表示旅客

2.订单表(order)

字段名称

类型

记录内容

是否为空

备注

o_id

Vachar2(100)

订单编号

0

自增长

o_uid

Varchar2(20)

用户名

0

o_tid

Varchar2(40)

票编号

0

o_time

Varchar2(40)

下单时间

0

3.票务信息(tickets)

字段名称

类型

记录内容

是否为空

备注

t_id

Vachar2(100)

机票编号

0

主键

t_f_id

number

航班id 号

0

t_uid

Varchar2(20)

用户Id

0

t_seatId

Number

座位号

0

t_date

Varchar2(20)

该票的日期

0

这是一个出发的日期

t_type

Varchar2(30)

座位类型

1

这是一个座位的类型

t_price

Number

票价

1

这个舱位的价格

4.航班信息(flight_info)

字段名称

类型

记录内容

是否为空

备注

f_id

number

航班id 号

0

航班起飞的ID号(主键)

f_number

Vachar2(30)

航班号

0

f_start_time

Varchar2(40)

出发时间

0

f_end_time

Varchar2(40)

到达时间

0

f_departure

Varchar2(40)

始发地

0

f_destination

Varchar2(40)

目的地

0

f_company

Varchar2(30)

航空公司

0

5.座位信息(seat)

字段名称

类型

记录内容

是否为空

备注

s_id

Number

座位唯一Id

0

标识 能够以下得到信息

f_id

number

航班id

0

航班id(外键)

s_ type

Varchar2(30)

舱位类型

0

舱位类型

s_number

Number

舱位数量

0

舱位数量

s_price

Number

舱位价格

0

舱位价格

6.航班动态表(state)

字段名称

类型

记录内容

是否为空

备注

fs_number

Varchar2(30)

航班号

0

航班号

fs_date

Varchar2(10)

航班飞行日期

0

航班

fs_state

Varchar2(300)

航班动态

0

航班动态

5.系统功能

1.普通用户

查询:根据航班号、航空公司以及目的地查询出票类信息。

订票:根据出发日期和航班号预订机票,机票类型分为单程和往返,一份订单可订多张机票 。

退票:要填写订单号、身份证、客户姓名以及航班信息等。

航班动态:可以根据出发城市、到达城市(或者是航班号)查看这个航班的最新动态。

2.管理员

查询:根据航班号、航空公司以及目的地查询出票类信息

订票:根据出发日期和航班号预订机票,机票类型分为单程和往返,一份订单可订多张机票 。

退票:要填写订单号、身份证、客户姓名以及航班信息等等。

销售统计:根据年份、月份统计总共买出的票数。

后台管理:管理员可以根据总部要求去创建航班、取消航班、航班查询。

6.工程截图

二、系统展示

1.注册页面

2.登录页面

3.查询预定

4.改签处理

5.航班动态

6.退票处理

7.销售统计

8.后台管理

9.创建航班

10.取消航班

11.修改航班

12.删除航班

三、部分代码

TicketSearchPanel

package com.sjsq.view;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.text.BreakIterator;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import java.util.Vector;

import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.UIManager;



import com.sjsq.bean.Bank;
import com.sjsq.bean.FlightAddr;
import com.sjsq.bean.FlightInfo;
import com.sjsq.bean.Seat;
import com.sjsq.bean.User;
import com.sjsq.model.CheckInfo;
import com.sjsq.model.DataHandle;
import com.sjsq.model.FileOperation;
import com.sjsq.model.MyButtonRenderer;
import com.sjsq.model.SearchTableModel;
import com.sjsq.tools.DBHelp;
import com.sjsq.tools.ImagePanel;
import com.sjsq.tools.Tookit;

public class TicketSearchPanel extends JPanel implements ActionListener,MouseListener{

	private ImagePanel ticketSearchPanel = null ;
	private HashMap<String, Bank> map= null ;//一个票Id是用什么 银行账号买的 
	private CardLayout card = null ;
	private JButton queryButton = null ;
	private JButton resetButton = null ;
	private JButton order ;
	private JTextField jtf1,jtf2,jtf3,jtf1_1,jtf2_1,jtf3_1, idField,priceField;
	private JComboBox jcBox,jcBox_1, boxType ;
	private JLabel jl1 ,jl2,jl3,jl4,jlTop;
	private JTable jTable ;
	private DataHandle dataHandle ;
	private Vector<FlightInfo> fInfos  ;
	private Vector<Vector<Seat>> seats ;
	private FlightInfo selectFlightInfo = null ; 
	private Vector<String> remainType = null ;
	private Vector<Seat> selectSeat =  null ; 
	private SearchTableModel stmModel ;
	private boolean isGoing  = false ;
	private JScrollPane jsp ;
	private String currenTime ,bankName;
	private User user ;
	private JPanel c ;
	private CheckInfo checkInfo ;
	public TicketSearchPanel(User user){
		checkInfo = new CheckInfo() ;
		map = new HashMap<String, Bank>() ;
		dataHandle = new DataHandle() ;
		this.user = user ;
		UIManager.put("Label.font", Tookit.getFont1()) ;
		UIManager.put("Button.font", Tookit.getFont1()) ;
		UIManager.put("ComboBox.font", Tookit.getFont1()) ;
		UIManager.put("CheckBox.font", Tookit.getFont1()) ;
		remainType = new Vector<String>() ;
		currenTime = Tookit.getDateFormat("yyyy-MM-dd").format(new Date()) ;
		card = new CardLayout() ;
		this.init();
	}
	/**
	 * 第一张面板
	 * @return
	 */
	public JPanel onePanel(){
		JPanel jPanel = new JPanel(new BorderLayout()) ;
		jPanel.setOpaque(false) ;
		
		//控制北边
		JPanel north = new JPanel() ;
		north.setPreferredSize(new Dimension(1028,145)) ;
		north.setOpaque(false) ;
		jPanel.add(north,BorderLayout.NORTH) ;
		
		JPanel center = new JPanel(null) ;
		center.setOpaque(false) ;
		
		 jl1= new JLabel("出发城市:");
		jl1.setBounds(200, 20, 74, 20) ;
		jl1.setFont(Tookit.getFont1()) ;
		 jtf1= new JTextField(12) ;
		jtf1.setBounds(275, 20, 130, 20) ;
	     jl2 = new JLabel("到达城市:");
		jl2.setBounds(200, 70, 74, 20) ;
		jl2.setFont(Tookit.getFont1()) ;
	    jtf2 = new JTextField() ;
		jtf2.setBounds(275, 70, 130, 20) ;
		 jl3 = new JLabel("出发日期:",JLabel.RIGHT);
		jl3.setFont(Tookit.getFont1()) ;
		jl3.setBounds(200, 120, 74, 20) ;
		 jtf3 = new JTextField(currenTime) ;
		jtf3.setBounds(275, 120, 130, 20) ;
		 jl4 = new JLabel("出发时间:",JLabel.RIGHT);
		jl4.setBounds(200, 175, 74, 20) ;
		jl4.setFont(Tookit.getFont1()) ;
		jcBox = new JComboBox(new String[]{"全部时间段","00:00-06:00","06:00-12:00","12:00-18:00","18:00-24:00"}) ;
		jcBox.setFont(Tookit.getFont1()) ;
		jcBox.setBounds(275, 170, 100, 30) ;

		queryButton = new JButton("开始查询");
		queryButton.addActionListener(this) ;
		queryButton.setFont(Tookit.getFont1()) ;
		queryButton.setBounds(180, 220, 120, 30) ;
		queryButton.setBackground(new Color(0xA9CAF3)) ;
		resetButton = new JButton("重新查询") ;
		resetButton.addActionListener(this) ;
		resetButton.setBackground(new Color(0xA9CAF3)) ;
		resetButton.setFont(Tookit.getFont1()) ;
		resetButton.setBounds(320, 220, 120, 30) ;
		
		center.add(jl1) ;
		center.add(jtf1) ;
		center.add(jl2) ;
		center.add(jtf2) ;
		center.add(jl3) ;
		center.add(jtf3) ;
		center.add(jl4) ;
		center.add(jcBox) ;
		center.add(queryButton) ;
		center.add(resetButton) ;
		
		jPanel.add(center) ;
		//控制南边
		JPanel south = new JPanel() ;
		south.setPreferredSize(new Dimension(1028,200)) ;
		south.setOpaque(false) ;
		jPanel.add(south,BorderLayout.SOUTH) ;
		
		return jPanel ;
	}
	
	public JPanel twoPanel(){
		JPanel jPanel = new JPanel(new BorderLayout()) ;
		jPanel.setOpaque(false) ;
		JPanel north = new JPanel() ;
		north.setOpaque(false) ;
		//得到所有 TextField值
		//加入到北边面板里
		jl1= new JLabel("出发城市:");
		jl1.setFont(Tookit.getFont1()) ;
		  jtf1_1 = new JTextField(12) ;
	     jl2 = new JLabel("到达城市:");
		jl2.setFont(Tookit.getFont1()) ;
		 jtf2_1 = new JTextField(12) ;
		 jl3 = new JLabel("出发日期:",JLabel.RIGHT);
		jl3.setFont(Tookit.getFont1()) ;
		 jtf3_1 = new JTextField() ;
		 jtf3_1.setPreferredSize(new Dimension(137, 23)) ;
		 jl4 = new JLabel("出发时间:",JLabel.RIGHT);
		jl4.setFont(Tookit.getFont1()) ;
		  jcBox_1 = new JComboBox(new String[]{"全部时间段","00:00-06:00","06:00-12:00","12:00-18:00","18:00-24:00"}) ;
		 jcBox_1.setFont(Tookit.getFont1()) ;

		queryButton = new JButton("开始查询");
		queryButton.addActionListener(this) ;
		queryButton.setFont(Tookit.getFont1()) ;
		queryButton.setBackground(new Color(0xA9CAF3)) ;
		
		order = new JButton("预订");
		order.addActionListener(this) ;
		order.setFont(Tookit.getFont1()) ;
		order.setBounds(180, 220, 120, 30) ;
		order.setBackground(new Color(0xA9CAF3)) ;
		
		north.add(jl1) ;
		north.add(jtf1_1) ;
		north.add(jl2) ;
		north.add(jtf2_1) ;
		north.add(jl3) ;
		north.add(jtf3_1) ;
		north.add(jl4) ;
		north.add(jcBox_1) ;
		north.add(queryButton) ;
		north.add(order) ;
		JPanel bank = new JPanel() ;//空面板
		bank.setOpaque(false) ;
		bank.setPreferredSize(new Dimension(1028,96)) ;
		JPanel top = new JPanel(new GridLayout(2,1)) ;
		top.setOpaque(false) ;
		top.add(bank)  ;
		top.add(north) ;
		jPanel.add(top,BorderLayout.NORTH) ;
	
		jsp = new JScrollPane() ;
		//jScrollPane设置透明
		jsp.setOpaque(false) ;
		jsp.getViewport().setOpaque(false) ;
		jPanel.add(jsp) ;
		return jPanel ;
	}
	
	private void init() {
		try {
			ticketSearchPanel = new ImagePanel(ImageIO.read(new File("image/ticketsearch.jpg")),new Dimension(Tookit.getScreen().width-100,Tookit.getScreen().height-100)) ;
			ticketSearchPanel.setLayout(card);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		ticketSearchPanel.add(this.onePanel(),"one") ;
		ticketSearchPanel.add(this.twoPanel(),"two") ;
		ticketSearchPanel.add(this.threePanel(),"three") ;
		ticketSearchPanel.add(this.fourPanel(),"four") ;
	}
	public JPanel getJPanel() {
		return ticketSearchPanel;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		
		if(e.getActionCommand().equals("开始查询")){
			if(!isGoing){
				jtf3_1.setText(jtf3.getText().trim()) ;
				jtf2_1.setText(jtf2.getText().trim());
				jtf1_1.setText(jtf1.getText().trim()) ;
			}
			this.query() ;
		}
		
		if(e.getActionCommand().equals("重新查询")){
			this.clear() ;
		}
		if(e.getActionCommand().equals("预订")){
			this.order();
		}
		if(e.getActionCommand().equals("重新选择")){
			card.show(ticketSearchPanel, "two") ;
		}
		if(e.getActionCommand().equals("取消订单")){
			card.show(ticketSearchPanel, "two") ;
		}
		if(e.getActionCommand().equals("提交订单")){
			
			//赋值
			jlTop.setText("<html>应付金额:<font color=#FF0000 size=7>"+priceField.getText().trim()+"</font>元</html>") ;
			
			//得到所有 的这个用户的银行信息
			Vector<String> v = dataHandle.queryStringVector("select b_name from bank where b_u_name=? and b_u_card=?", new String[]{user.getU_name(),user.getU_idcard()}) ;
			//判断 有没有该账号
			if(v.size()==0){
				//表示 该用户没有网上银行
				JOptionPane.showMessageDialog(null, "没有网上银行,请注册!") ;
				//跳转
				card.show(ticketSearchPanel, "two") ;
				return ;
			}
			System.out.println(v);
			c.removeAll() ;//清除面板所有组件
			
			for(String bankNames:v){	
				Box box = Box.createVerticalBox() ;
				JLabel jl_bank =  new JLabel(bankNames,JLabel.CENTER);
				jl_bank.setFont(Tookit.getFont3()) ;
				box.add(jl_bank) ;
				jl_bank.addMouseListener(TicketSearchPanel.this) ;
				jl_bank.setEnabled(false) ;
				JLabel jl_picture = new JLabel(new ImageIcon("image/"+bankNames+".jpg")) ;
				box.add(jl_picture) ;
				c.add(box) ;
			}
			//跳到付款页面
			card.show(ticketSearchPanel, "four") ;
		}
		if(e.getActionCommand().equals("网上支付")){
			//判断钱是不是足够的
			String sql = "select b_balance from bank where b_u_name=? and b_u_card=? and b_name=?" ;
			String balanceString = dataHandle.queryOneString(sql, new String[]{user.getU_name(),user.getU_idcard(),bankName}) ;
			sql = "select b_account from bank where b_u_name=? and b_u_card=? and b_name=?" ;
			String account = dataHandle.queryOneString(sql, new String[]{user.getU_name(),user.getU_idcard(),bankName}) ;
			
			System.out.println(balanceString);	
			if(balanceString==null){
					JOptionPane.showMessageDialog(null, "请选择网上银行") ;
					return ;
				}
			double balance = Double.parseDouble(balanceString) ;
			//得到 当前票价
			double currentPrice = Double.parseDouble(priceField.getText().trim());
			if(balance<currentPrice){
				JOptionPane.showMessageDialog(TicketSearchPanel.this, "余额不足,无法支付!") ;
				//跳转
				card.show(ticketSearchPanel, "four") ;
				return ;
			}
			sql = "select t_seatId from tickets where t_date=? and t_f_number =? and t_type=?" ;
			//得到已卖座位号
			System.out.println(jtf3_1.getText().trim()+selectFlightInfo.getF_number()+(String)boxType.getSelectedItem());
			Vector<String> seatIds = dataHandle.queryStringVector(sql, new String[]{jtf3_1.getText().trim(),selectFlightInfo.getF_number(),(String)boxType.getSelectedItem()}) ;
			//分配座位 
			//得到 选择舱位的总数 
			int seatTotalNum = 0 ;
		     for(Seat seat : selectSeat){
		    	 if(seat.getS_type().equals((String)boxType.getSelectedItem())){
		    		 seatTotalNum = Integer.parseInt(seat.getS_number()) ;
		    		 break ;
		    	 }
		     }
		     //卖到 的座位号
		     int sellSeatNum = -1 ;
		     System.out.println("座位总数:"+seatTotalNum+"已卖出:"+seatIds);
		     
		     for (int i = 1; i <=seatTotalNum; i++) {
				
		    	 if(!seatIds.contains(i+"")){
		    		 sellSeatNum = i ;
		    		 break ;
		    	 }
			}	    
		    System.out.println(sellSeatNum);
		    System.out.println(selectFlightInfo.getF_number());
			//插入一个票务表
			sql = "insert into tickets values(?,?,?,?,?,?)" ;
			boolean b1 = dataHandle.update(sql, new String[]{"e"+new Random().nextInt(10000),selectFlightInfo.getF_number(),user.getU_id(),sellSeatNum+"",(String)boxType.getSelectedItem(),jtf3_1.getText().trim()}) ;
			//插入一个订单表
			sql = "select t_id from tickets where t_date=? and t_seatId=? and t_type=?" ;
		    String sellTicketId = dataHandle.queryOneString(sql, new String[]{jtf3_1.getText().trim(),sellSeatNum+"",(String)boxType.getSelectedItem()}) ;
			System.out.println("卖出的票的id:"+sellTicketId);
		    boolean b2 = dataHandle.update("insert into orders values(?,?,?,?)", new String[]{"O"+(new Random().nextInt(10000)),user.getU_id(),sellTicketId,currenTime}) ;
			//更新  bank表
			String remainBalance = (balance-currentPrice)+"" ;
			boolean b3 = dataHandle.update("update bank set b_balance=? where b_name=? and b_u_name=? and b_u_card=?", new String[]{remainBalance,bankName,user.getU_name(),user.getU_idcard()}) ;
		    System.out.println(b1+"  "+b2+"  "+b3+" ");
			if(b1 && b2 && b3){
				JOptionPane.showMessageDialog(null, "<html>恭喜"+user.getU_name()+"订票成功"+"<br>票号为:"+sellTicketId+"<br>座位号:"+(String)boxType.getSelectedItem()+"   ZX"+sellSeatNum+"<br>登机时间:"+jtf3_1.getText().trim()+"   "+selectFlightInfo.getF_start_time()+"<br>票价 :"+priceField.getText()+"</html>") ;
				//产生一个票
				FileOperation fileOperation = new FileOperation() ;
				boolean b4 = fileOperation.saveTickets(selectSeat.get(0), user, "   ZX"+sellSeatNum, (String)boxType.getSelectedItem(), jtf3_1.getText().trim(),sellTicketId) ;
				if(b4){
					JOptionPane.showMessageDialog(null, "票已保存在path/"+sellTicketId+"下") ;
				}else {
					JOptionPane.showMessageDialog(null, "票保存失败!!") ;
				}
				//将   这个 票的id 跟  银行卡号加入到一个hashMap里。。方便以后 退票
				Bank bank = dataHandle.queryOneBank("select * from bank where b_u_name=? and b_u_card=? and b_name=?", new String[]{user.getU_name(),user.getU_idcard(),bankName},user) ;
				//加载map信息
				HashMap<String, Bank> map = fileOperation.loadBank() ;
				if(map==null){
					map = new HashMap<String, Bank>() ;//防止 第一次的时候 没有值 
				}
				map.put(sellTicketId, bank) ;//放一个值 
				//保存到文件 里
				fileOperation.saveBank(map) ;
				
			}else{
				JOptionPane.showMessageDialog(null, "订票失败") ;
			}
			card.show(ticketSearchPanel, "two") ;
			this.query() ;
		}
	}
	
	public void clear(){
		this.jtf1.setText("") ;
		this.jtf2.setText("") ;
		this.jtf3.setText("") ;
		this.jcBox.setSelectedIndex(0) ;
	}
	
	public JPanel threePanel(){
		
		JPanel jPanel = new JPanel(new BorderLayout()) ;
		jPanel.setOpaque(false) ;
		//上面是一个空panel
		JPanel blankTop = new JPanel() ;
		blankTop.setOpaque(false) ;
		blankTop.setPreferredSize(new Dimension(Tookit.getScreen().width,103)) ;
		jPanel.add(blankTop,BorderLayout.NORTH) ;
		
		JPanel center = new JPanel(new BorderLayout()) ;
		center.setOpaque(false) ;
		JPanel top = new JPanel(new GridLayout(2, 7, 63, 30)) ;
		top.setOpaque(false) ;
		JLabel id = new JLabel("航班号",JLabel.CENTER) ;
		JLabel type = new JLabel("舱位",JLabel.CENTER) ;
		JLabel price = new JLabel("价格",JLabel.CENTER) ;
		JLabel name = new JLabel("姓名",JLabel.CENTER);
		JLabel cardType = new JLabel("证件类型",JLabel.CENTER) ;
		JLabel cardNum = new JLabel("证件号码") ;
		JLabel telNum = new JLabel("手机号码") ;
		
		idField = new JTextField() ;
		idField.setEditable(false) ;
		boxType = new JComboBox(remainType) ;//录用数据
	    priceField = new JTextField() ;
		priceField.setEditable(false) ;
		JTextField nameField = new JTextField(user.getU_name()) ;
		nameField.setEditable(false) ;
		JComboBox boxCardType = new JComboBox(new String[]{"身份证","学生证","居民证"}) ;
		JTextField cardNumField = new JTextField(user.getU_idcard()) ;
		cardNumField.setEditable(false) ;
		JTextField telNumField = new JTextField(user.getU_telephone()) ;
		telNumField.setEditable(false) ;
		top.add(id) ;
		top.add(type) ;
		top.add(price) ;
		top.add(name) ;
		top.add(cardType) ;
		top.add(cardNum) ;
		top.add(telNum) ;
		
		top.add(idField) ;
		top.add(boxType) ;
		top.add(priceField) ;
		top.add(nameField) ;
		top.add(boxCardType) ;
		top.add(cardNumField) ;
		top.add(telNumField) ;
		//top.setOpaque(false) ;
		center.add(top,BorderLayout.NORTH) ;
		//监听 
		boxType.addItemListener(new ItemListener() {
			
			@Override
			public void itemStateChanged(ItemEvent e) {
				if(remainType.size()!=0){
					//有舱位
					String string = (String)boxType.getSelectedItem() ;
					for(Seat seat :selectSeat){
						if(seat.getS_type().equals(string)){
							priceField.setText(seat.getS_price()+"") ;
							break ;
						}
					}
				}
			}
		}) ;
		
		//中间是一个
		//JPanel c = new JPanel() ;
		String s = "<html>1.一张有效身份证件同一乘车日期同一车次只能购买一张车票。 <br>2.购票时可使用的有效身份证件包括:中华人民共和国居民身份证、港澳居民来往内地通行证、台湾居民来往大陆通行证和按规定可使用的有效护照。<br>3. 购买儿童票时,乘车儿童有有效身份证件的,请填写本人有效身份证件信息。乘车儿童没有有效身份证件的,应使用同行成年人的有效身份证件信息;购票时不受前条限制,<br>4.但购票后、开车前须办理换票手续方可进站乘车。 <br>5.购买学生票时,须在我的常用联系人中登记乘车人的学生详细信息。学生票乘车时间限为每年的暑假6月1日至9月30日、寒假12月1日至3月31日。购票后、开车前,须办理换票手续方可进站乘车。换票时,新生凭录取通知书,毕业生凭学校书面证明,其他凭学生优惠卡。 <br>购买残疾军人(伤残警察)优待票的,须在购票后、开车前办理换票手续方可进站乘车。换票时,不符合规定的减价优待条件,没有有效中华人民共和国残疾军人证或中华<br>人民共和国伤残人民警察证的,不予换票,所购车票按规定办理退票手续。</html>";
		JLabel text = new JLabel(s) ;
		center.add(text) ;
		
		JPanel bottom = new JPanel() ;
		bottom.setOpaque(false) ;
		JButton reSelect = new JButton("重新选择");
		reSelect.addActionListener(this) ;
		reSelect.setFont(Tookit.getFont1()) ;
		reSelect.setBackground(new Color(0xA9CAF3)) ;
		JButton cancelSelect = new JButton("取消订单");
		cancelSelect.addActionListener(this) ;
		cancelSelect.setFont(Tookit.getFont1()) ;
		cancelSelect.setBackground(new Color(0xA9CAF3)) ;
		JButton subSelect = new JButton("提交订单");
		subSelect.addActionListener(this) ;
		subSelect.setFont(Tookit.getFont1()) ;
		subSelect.setBounds(180, 220, 120, 30) ;
		subSelect.setBackground(new Color(0xA9CAF3)) ;
		bottom.add(reSelect) ;
		bottom.add(cancelSelect) ;
		bottom.add(subSelect) ;
		center.add(bottom,BorderLayout.SOUTH) ;
		jPanel.add(center) ;
		//下面是一个空panel
		JPanel blankbottom = new JPanel() ;
		blankbottom.setOpaque(false) ;
		blankbottom.setPreferredSize(new Dimension(Tookit.getScreen().width,103)) ;
		jPanel.add(blankbottom,BorderLayout.SOUTH) ;
		return jPanel ;
	}
	
	public JPanel fourPanel(){
		
		JPanel jPanel = new JPanel(new BorderLayout()) ;
		jPanel.setOpaque(false) ;
		//上面是一个空panel
		JPanel blankTop = new JPanel() ;
		blankTop.setOpaque(false) ;
		blankTop.setPreferredSize(new Dimension(Tookit.getScreen().width,103)) ;
		jPanel.add(blankTop,BorderLayout.NORTH) ;
		
		JPanel center = new JPanel(new BorderLayout()) ;
		center.setOpaque(false) ;
		 jlTop = new JLabel() ;
		jlTop.setOpaque(false) ;
		
		center.add(jlTop,BorderLayout.NORTH) ;//中间北部
		
		//中间是一个janel
		//上面
		 c = new JPanel() ;
		 c.setOpaque(false) ;
		 center.add(c) ;//中间的中间
		 //中间的南部
		 JPanel jPanel3 = new JPanel(new GridLayout(2, 1)) ;
		  jPanel3.setOpaque(false) ;
		  
		 JLabel jlBottom = new JLabel("<html>1.请您选择支付银行。建议使用中国工商银行、中国农业银行、中国银行、招商银行、中国建设银行的银行卡,支付请直接点击相应银行的<br>按钮;如果您使用其他银行的银行卡,请点击“中国银联”按钮。<br>2.您点击支付银行后,将进入银行页面。请遵守相关银行规定进行操作。您在银行页面上进行的任何操作及其产生的任何法律后果,将按照<br>您与银行之间签订的合同处理。本网站不承担任何责任。</html>") ;
		 jPanel3.add(jlBottom) ;
		 
	 	JPanel jPanel2 = new JPanel() ;
	 	jPanel2.setOpaque(false) ;
		JButton reSelect1 = new JButton("重新选择");
		reSelect1.addActionListener(this) ;
		reSelect1.setFont(Tookit.getFont1()) ;
		reSelect1.setBackground(new Color(0xA9CAF3)) ;
		
		JButton onLine = new JButton("网上支付");
		onLine.addActionListener(this) ;
		onLine.setFont(Tookit.getFont1()) ;
		onLine.setBounds(180, 220, 120, 30) ;
		onLine.setBackground(new Color(0xA9CAF3)) ;
		jPanel2.add(reSelect1) ;
		jPanel2.add(onLine) ;
		jPanel3.add(jPanel2) ;
		
		//jPanel3.add(jlBottom) 
		center.add(jPanel3,BorderLayout.SOUTH) ;
		
		jPanel.add(center) ;
		//下面是一个空panel
		JPanel blankbottom = new JPanel() ;
		blankbottom.setOpaque(false) ;
		blankbottom.setPreferredSize(new Dimension(Tookit.getScreen().width,103)) ;
		jPanel.add(blankbottom,BorderLayout.SOUTH) ;
		return jPanel ;
	}
	/**
	 * 开始查询
	 */
	public void query (){
		
		String startCity = null ,endCity = null,startDate = null,startTime ;
		if(!isGoing){
			//表示 是第一个页面进入
			System.out.println("-------");
			startCity = this.jtf1.getText().trim() ;
			 endCity = this.jtf2.getText().trim();
			 startDate = this.jtf3.getText().trim() ;//需要作 判断
			 startTime  = (String)this.jcBox.getSelectedItem() ;
			
		}else {
			startCity = this.jtf1_1.getText().trim() ;
			 endCity = this.jtf2_1.getText().trim();
			 startDate = this.jtf3_1.getText().trim() ;//需要作 判断
			 startTime  = (String)this.jcBox_1.getSelectedItem() ;
		}
		//拆分
		System.out.println(startTime);
		String str[] = startTime.split("-") ;
		//判断 是不是全为空
		if(startCity.equals("") || endCity.equals("") || startDate.equals("")){
			JOptionPane.showMessageDialog(TicketSearchPanel.this, "请输入数据!!") ;
			return ;
		}
		//检查日期是不是有误
		if(!checkInfo.isTrue(startDate)){
			JOptionPane.showMessageDialog(null, "日期不正确,请重新输入!") ;
			return ;
		}
		isGoing = true ;
		card.show(ticketSearchPanel, "two") ;

		//首先根据 出发城市跟到达城市 查出所有 这个路线的航班地点表的Id
	
		String sql = "select * from flight_addr where a_city=?" ;
		String[] paraStartCity = {startCity} ;
		String[] paraEndCity = {endCity};
		//查出所有 出发城市的航班地点Id号
		Vector<FlightAddr> startCityIds = dataHandle.quertyMulInfo(sql, paraStartCity) ;
		//如果为空null,,表示 没有该起点城市 机场。。。。。需要转承、、、、
		//查出所有 到达城市的航班地点Id号
		Vector<FlightAddr> endCityIds = dataHandle.quertyMulInfo(sql, paraEndCity) ;
		
		//查出所有 的  从出发城市到到达城市 航班 飞机信息
		fInfos = dataHandle.queryMulFlightInfo(startCityIds, endCityIds,str) ;
		
		if(fInfos.size()==0){
			//表示没有直达的飞机
			JLabel jLabel = new JLabel("<html>没有直达飞机,是否<font color=#FF0000 size=7>转承</font></html>",JLabel.CENTER) ;
			
			jLabel.setFont(Tookit.getFont2()) ;
			jsp.setViewportView(jLabel) ;
			//预订按钮不可见
			order.setEnabled(false) ;
		}else {
			order.setEnabled(true) ;
			//查出所有 这个航班飞机的座位详细信息
			seats = new Vector<Vector<Seat>>() ;
			for(FlightInfo fInfo:fInfos){
				Vector<Seat> seat = dataHandle.querySeatsInfo("select * from seat where f_number=?", new String[]{fInfo.getF_number()},fInfo) ;
				seats.add(seat) ;
//				System.out.println(fInfo.getF_number()+"   "+fInfo.getF_start().getA_city()+"    "+fInfo.getF_start().getA_air()+"   "+fInfo.getF_end().getA_city()+"   " +fInfo.getF_end().getA_air()+"   "+fInfo.getF_start_time()+"  "+fInfo.getF_end_time());
			}
			//创建一个数据模型
			//放一个jtable 
			jTable = new JTable();
			stmModel = new SearchTableModel(seats,startDate) ;
			this.jTable.setModel(stmModel) ;
			//MyButtonRenderer   buttonRenderer= new MyButtonRenderer(jTable, 12) ;
			
			//jTable.getColumn("购票").setCellRenderer(buttonRenderer) ;//设置 一个button 在Jtable上
			jTable.setRowHeight(60) ;
			jTable.setBackground(new Color(0xA9CAF3)) ;
			jsp.setViewportView(jTable);
		}	
	}
	
	public void order(){
		

		//得到 选中的行
		int selectedRow = jTable.getSelectedRow() ;
		if(selectedRow==-1){
			JOptionPane.showMessageDialog(null, "至少选 中一行进行预订") ;
			return ;
		}
	
		//跳到第三个面板 上
		//得到User信息 
		//得到 Seat信息
		String selectFlightId = (String)stmModel.getValueAt(selectedRow, 0) ;
		//判断这个jtf3_1.getText().trim()日期  是否有航班动态 
		String state =dataHandle.queryOneString("select fs_state from state where fs_date=? and fs_number=?", new String[]{jtf3_1.getText().trim(),selectFlightId}) ;
		System.out.println(state);
		if(state!=null){
			if(state.matches(".*取消.*|.*延迟.*|.*推迟.*")){
				JOptionPane.showMessageDialog(null, "此航班在"+jtf3_1.getText().trim()+"已被取消,请关注航班动态信息") ;
				return ;
			}
		}
		for(FlightInfo fInfo: fInfos){
			if(fInfo.getF_number().equals(selectFlightId)){
				selectFlightInfo = fInfo ;
				break;
			}
		}
		for (Vector<Seat> v : seats) {
			for(Seat seat:v){
				if(seat.getfInfo().equals(selectFlightInfo)){
					selectSeat = v ;
					break ;
				}
			}
		}
		if(selectFlightInfo==null || selectSeat==null){
			JOptionPane.showMessageDialog(null, "数据出错!!") ;
			return ;
		}
		//选择的余数  经济舱  商务舱  头等舱
		String num1 = (String)stmModel.getValueAt(selectedRow, 8) ;
		String num2 = (String)stmModel.getValueAt(selectedRow, 9) ;
		String num3 = (String)stmModel.getValueAt(selectedRow, 10) ;
		//JOptionPane.showMessageDialog(null,jTable.getColumnName(8) ) ;
		//System.out.println(num1+"  "+num2+"  "+num3);
		remainType.removeAllElements() ;//移除所有 的元 素  防止 返回再次点入
		if(num1.matches("[1-9][0-9]*")){
			//表示 经济舱有票
			System.out.println(num1);
			remainType.add(jTable.getColumnName(8)) ;
		}
		if(num2.matches("[1-9][0-9]*")){
			//表示 经济舱有票
			remainType.add(jTable.getColumnName(9)) ;
		}
		if(num3.matches("[1-9][0-9]*")){
			//表示 经济舱有票
			remainType.add(jTable.getColumnName(10)) ;
		}
		System.out.println(remainType.size());
		boxType.setSelectedIndex(0) ;
		idField.setText(selectFlightId)  ;
		
		card.show(ticketSearchPanel, "three") ;
		//得到 
	
	}
	@Override
	public void mouseClicked(MouseEvent e) {
		
		if(e.getSource() instanceof JLabel){
			
			bankName = ((JLabel)e.getSource()).getText().trim() ; 
		}
		
	}
	@Override
	public void mouseEntered(MouseEvent e) {
		
		if(e.getSource() instanceof JLabel){
			JLabel mjlJLabel = ((JLabel)e.getSource()) ;
			mjlJLabel.setEnabled(true) ;
			mjlJLabel.setForeground(Tookit.getColor()) ;
			mjlJLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
		}
		
	}
	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		if(e.getSource() instanceof JLabel){
			JLabel mjlJLabel = ((JLabel)e.getSource()) ;
			mjlJLabel.setEnabled(false) ;
			mjlJLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)) ;
		}
	}
	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
}

Userinformodification

package com.sjsq.view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import com.sjsq.bean.User;
import com.sjsq.model.CheckInfo;
import com.sjsq.model.DataHandle;
import com.sjsq.tools.ImagePanel;
import com.sjsq.tools.Tookit;

public class Userinformodification extends JDialog implements MouseListener{
	private ImagePanel ip;
	JLabel userId;
	JLabel userPasswd1;
	JLabel userPasswd ;
	JLabel userName;
	JLabel userSex;
	JRadioButton boy;
	JRadioButton girl;
	JLabel tel;
	JLabel addr;
	JLabel email;
	JLabel identity;
	private User user ;
	Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
	public Userinformodification(JFrame jFrame,User user){
		this.user= user ;
		this.init();
	}
	public void init(){	
		
		this.setSize(600, 700) ;
		this.setModal(true);
		this.setLocationRelativeTo(null) ;
		this.setResizable(false) ;
		this.setTitle("用户信息修改") ;
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) ;
		ImagePanel jPanel = null;
		try {
			jPanel = new ImagePanel(ImageIO.read(new File("image/171go.jpg")), dimension);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		JPanel jpAll=new JPanel();
		jpAll.setLayout(new BorderLayout());
		jpAll.setOpaque(false) ;
		JPanel jopJPanel=new JPanel();
		JLabel jluser=new JLabel("用户信息修改");
//		jluser.setForeground(new Color(0xC4C43B));
		jluser.setFont(Tookit.getFont2());
		jopJPanel.add(jluser);
		jpAll.add(jopJPanel,BorderLayout.NORTH);
		jPanel.add(jpAll);
		jopJPanel.setOpaque(false);
		
		JPanel infoPanel = new JPanel(new GridLayout(9, 2,2,20)) ;
		infoPanel.setOpaque(false) ;
		infoPanel.setPreferredSize(new Dimension(450, 500)) ;
		userId = new JLabel("用户名:",JLabel.CENTER);
		
		userId.setFont(Tookit.getFont1()) ;
		infoPanel.add(userId) ;
		final JTextField userIdField = new JTextField(user.getU_id()) ;
		userIdField .setEnabled(false) ;
		infoPanel.add(userIdField) ;
		userPasswd = new JLabel("密码:",JLabel.CENTER);
		userPasswd.setFont(Tookit.getFont1()) ;
		infoPanel.add(userPasswd) ;
		final JPasswordField userPasswdField = new JPasswordField(user.getU_password()) ;
		infoPanel.add(userPasswdField) ;
		userName = new JLabel("姓名:",JLabel.CENTER);
		userName.setFont(Tookit.getFont1()) ;
		infoPanel.add(userName) ;
		final JTextField userNameField = new JTextField(user.getU_name()) ;
		infoPanel.add(userNameField) ;
		userSex = new JLabel("性别:",JLabel.CENTER) ;
		userSex.setFont(Tookit.getFont1()) ;
		JPanel jSex = new JPanel() ;
		jSex.setOpaque(false) ;
		boy = new JRadioButton("男") ;
		boy.setOpaque(false) ;
		boy.setFont(Tookit.getFont1()) ;
		girl = new JRadioButton("女") ;
		girl.setOpaque(false) ;
		girl.setFont(Tookit.getFont1()) ;
		ButtonGroup gbGroup = new ButtonGroup();
		gbGroup.add(boy) ;
		gbGroup.add(girl) ;
		jSex.add(boy) ;
		jSex.add(girl) ;
		if(user.getU_sex().equals("男")){
			boy.setSelected(true) ;
		}
		if (user.getU_sex().equals("女")) {
			girl.setSelected(true);
		}
		infoPanel.add(userSex);
		infoPanel.add(jSex) ;
		tel = new JLabel("电话号码:",JLabel.CENTER);
		tel.setFont(Tookit.getFont1()) ;
		infoPanel.add(tel) ;
		final JTextField telField = new JTextField(user.getU_telephone()) ;
		infoPanel.add(telField) ;
		addr = new JLabel("地址:",JLabel.CENTER);
		addr.setFont(Tookit.getFont1()) ;
		infoPanel.add(addr) ;
		final JTextField addrField = new JTextField(user.getU_address()) ;
		infoPanel.add(addrField) ;
		email = new JLabel("电子邮件:",JLabel.CENTER);
		email.setFont(Tookit.getFont1()) ;
		infoPanel.add(email) ;
		final JTextField emailField = new JTextField(user.getU_email()) ;
		infoPanel.add(emailField) ;
		identity = new JLabel("身份证号:",JLabel.CENTER);
		identity.setFont(Tookit.getFont1()) ;
		infoPanel.add(identity) ;
		final JTextField identityField = new JTextField(user.getU_idcard()) ;
		infoPanel.add(identityField) ;
		jpAll.add(infoPanel,BorderLayout.CENTER);
		
		JPanel jButtom =new JPanel();
		JButton affirm = new JButton("确认") ;
		affirm.setFont(Tookit.getFont1()) ;
		jButtom.add(affirm);
		JButton cancel = new JButton("取消") ;
		cancel.setFont(Tookit.getFont1()) ;
		jButtom.add(cancel);
		jpAll.add(jButtom,BorderLayout.SOUTH);
		jButtom.setOpaque(false);
//		jPanel.add(Box.createRigidArea(new Dimension(dimension.width, 50))) ;
		jPanel.add(jpAll) ;
		this.add(jPanel) ;	
		affirm.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				String uId=userIdField.getText().trim();
				String uPassword=String.valueOf(userPasswdField.getPassword());
				String uName = userNameField.getText().trim();
				String uSex  = null;
				if(boy.isSelected()){
					uSex=boy.getText().trim();
				}
				if(girl.isSelected()){
					uSex=girl.getText().trim();
				}
				String uTelephone=telField.getText().trim();
				String uAddress  =addrField.getText().trim();
				String uEmail   = emailField.getText().trim();
				String uIdcard = identityField.getText().trim();
				
				//判断所有的是否为空
				if(uId.isEmpty()||uPassword.isEmpty()||uName.isEmpty()||uSex.isEmpty()||uTelephone.isEmpty()||uAddress.isEmpty()||uEmail.isEmpty()||uIdcard.isEmpty()){
					JOptionPane.showMessageDialog(null, "所填项不能为空!");
					return;
				}
				//创建一个User
				User user = new User(uId, uPassword, uName, uSex, uTelephone, uAddress, uEmail, uIdcard, "0");
				CheckInfo checkInfo =new CheckInfo() ;
				boolean b = checkInfo.check(user) ;
				System.out.println(b);
				if(b==true){
					//表示 数据 格式 是 正确的  此时连接数据库操作
					String sql="update users set u_password=?,u_name=?,u_sex=?,u_telephone=?,u_address=?,u_email=?,u_idcard=?  where u_id=?";
					String[] ss={ uPassword, uName, uSex, uTelephone, uAddress, uEmail, uIdcard,uId};
					
					DataHandle dataHandle=new DataHandle();
					boolean iss=dataHandle.update(sql, ss);
					if(iss){
						JOptionPane.showMessageDialog(null, "修改成功!请重新登录");
						Userinformodification.this.dispose() ;
						new LoginView().setVisible(true) ;
					}else{
						JOptionPane.showMessageDialog(null, "修改失败!");
						return;
					}					
				}
				
			}
		});
		cancel.addActionListener(new ActionListener() {		
			@Override
			public void actionPerformed(ActionEvent e) {
				Userinformodification.this.dispose() ;
//				userIdField.setText("") ;
//				userNameField.setText("") ;
//				userPasswdField.setText("") ;
//				telField.setText("") ;
//				addrField.setText("") ;
//				emailField.setText("") ;
//				identityField.setText("") ;
			}
		});
	}
	@Override
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub	
	}
	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub		
	}
	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub	
	}
	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub		
	}
	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub		
	}
}

ModifyTicketPanel

package com.sjsq.view;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.Vector;

import javax.imageio.ImageIO;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import com.sjsq.bean.Bank;
import com.sjsq.bean.FlightInfo;
import com.sjsq.bean.Seat;
import com.sjsq.bean.User;
import com.sjsq.model.DataHandle;
import com.sjsq.model.ReturnTicketModel;
import com.sjsq.tools.ImagePanel;
import com.sjsq.tools.Tookit;

public class ModifyTicketPanel extends JPanel implements ActionListener{
	


	private ImagePanel iPanel = null ;
	private CardLayout card = null ;
	private JButton queryButton, unButton ,backButton= null ;
	private JScrollPane jsp ;
	private DataHandle dataHandle ;
	private JTable jTable ;
	//private JButton resetButton  = null ;
	private User user  ;
	public ModifyTicketPanel(User user){
		dataHandle = new DataHandle() ;
		this.user = user ;
		this.init();
	}
	
	public JPanel onePanel(){
		JPanel jp = new JPanel(null) ;//空布局
		jp.setOpaque(false) ;
		
		JLabel jl1 = new JLabel("姓    名:",JLabel.RIGHT) ;
		jl1.setBounds(230, 217, 84, 18) ;
		jl1.setFont(Tookit.getFont1()) ;
		JTextField jtf1 = new JTextField(user.getU_name()) ;
		jtf1.setEditable(false) ;
		jtf1.setBounds(320, 217, 174, 22) ;
		
		JLabel jl2 = new JLabel("身份证号码:",JLabel.RIGHT) ;
		jl2.setBounds(230, 260, 84, 18) ;
		jl2.setFont(Tookit.getFont1()) ;
		JTextField jtf2 = new JTextField(user.getU_idcard()) ;
		jtf2.setEditable(false) ;
		jtf2.setBounds(320, 260, 174, 22) ;
		
		
		queryButton = new JButton("开始查询");
		queryButton.addActionListener(this) ;
		queryButton.setFont(Tookit.getFont1()) ;
		queryButton.setBounds(230,300,120,30) ;
		queryButton.setBackground(new Color(0xA9CAF3)) ;
//		resetButton = new JButton("返回") ;
//		resetButton.addActionListener(this) ;
//		resetButton.setBackground(new Color(0xA9CAF3)) ;
//		resetButton.setFont(Tookit.getFont1()) ;
//		resetButton.setBounds(380, 300, 120, 30) ;
		
		jp.add(jl1) ;
		jp.add(jtf1);
		jp.add(jl2) ;
		jp.add(jtf2);
		jp.add(queryButton) ;
//		jp.add(resetButton) ;
		
		return jp ;
	}
	private void init() {
		try {
			card = new CardLayout() ;
			iPanel = new ImagePanel(ImageIO.read(new File("image/returnticket.jpg")),new Dimension(1280,800)) ;
			iPanel.setLayout(card);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		iPanel.add(this.onePanel(),"one") ;
		iPanel.add(this.twoPanel(),"two") ;
		
	}
	public JPanel getJPanel() {
		
		return iPanel;
	}
	
	public JPanel twoPanel(){	
		
		JPanel jp = new JPanel(new BorderLayout());
		jp.setOpaque(false) ;
		//北边
		JPanel north = new JPanel() ;
		north.setOpaque(false) ;
		north.setPreferredSize(new Dimension(Tookit.getScreen().width,94)) ;
		jp.add(north,BorderLayout.NORTH) ;
		
		
		//中间
		JPanel center = new JPanel(new BorderLayout());
		center.setOpaque(false) ;
		JLabel jlName = new JLabel("用户:"+user.getU_name()+"的订票信息",JLabel.CENTER);
		jlName.setFont(Tookit.getFont5()) ;
		jlName.setBackground(Color.red) ;
		center.add(jlName,BorderLayout.NORTH) ;
		
		 jsp = new JScrollPane() ;
		//jScrollPane设置透明
		jsp.setOpaque(false) ;
		jsp.getViewport().setOpaque(false) ;
		center.add(jsp) ;
		jp.add(center) ;
		
		JPanel jpBottom = new JPanel() ;
		jpBottom.setOpaque(false) ;
		 unButton = new JButton("改  签");
		unButton.addActionListener(this) ;
		unButton.setFont(Tookit.getFont1()) ;
		unButton.setBackground(new Color(0xA9CAF3)) ;
		 backButton = new JButton("返   回") ;
		backButton.addActionListener(this) ;
		backButton.setBackground(new Color(0xA9CAF3)) ;
		backButton.setFont(Tookit.getFont1()) ;
		jpBottom.add(unButton) ;
		jpBottom.add(backButton) ;
		jp.add(jpBottom,BorderLayout.SOUTH) ;
		
		return jp ;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		
		if(e.getActionCommand().equals("开始查询")){
			this.query() ;
		}
		if(e.getSource()==backButton){
			card.show(iPanel, "one") ;
		}
		
		if(e.getSource()==unButton){
			//点击退订
			//得到 选中的行
			int selectedRow = jTable.getSelectedRow() ;
			if(selectedRow==-1){
				JOptionPane.showMessageDialog(null, "请选 中一行进行改签") ;
				return ;
			}
		
			String ticketId = (String)jTable.getValueAt(selectedRow, 0) ;
			JOptionPane.showMessageDialog(null, ticketId) ;
			
			//跳出一个改签的对话框
			String modifyDate = JOptionPane.showInputDialog(null, "请输入你要改签的日期:") ;
			String sql = "select t_seatId from tickets where t_date=? and t_f_number =? and t_type=?" ;
			//得到这个日期已卖座位号
			//System.out.println(jtf3_1.getText().trim()+selectFlightInfo.getF_number()+(String)boxType.getSelectedItem());
			Vector<String> seatIds = dataHandle.queryStringVector(sql, new String[]{modifyDate,(String)jTable.getValueAt(selectedRow, 1),(String)jTable.getValueAt(selectedRow, 4)}) ;
			//分配座位 
			//得到 选择舱位的总数 
			String seatTotalNumString = dataHandle.queryOneString("select s_number from seat where f_number=? and s_type=?", new String[]{(String)jTable.getValueAt(selectedRow, 1),(String)jTable.getValueAt(selectedRow, 4)}) ;
		     System.out.println("座位总数为:"+seatTotalNumString);
		     int seatTotalNum = Integer.parseInt(seatTotalNumString) ;
		     //卖到 的座位号
		     int sellSeatNum = -1 ;
		     System.out.println("座位总数:"+seatTotalNum+"已卖出:"+seatIds);
		     
		     for (int i = 1; i <=seatTotalNum; i++) {
		    	 if(!seatIds.contains(i+"")){
		    		 sellSeatNum = i ;
		    		 break ;
		    	 }
			}
		     if(sellSeatNum==-1){
		    	 JOptionPane.showMessageDialog(null, "对不起!"+modifyDate+"票已经卖完") ;
		    	 return ;
		     }
		     
		     //更新  日期  跟座位号
		     boolean b = dataHandle.update("update tickets set t_seatId=?,t_date=? where t_id=?", new String[]{sellSeatNum+"",modifyDate,ticketId}) ;
			if(b){
				JOptionPane.showMessageDialog(null, "<html>修改成功!<br>座位号为: "+(String)jTable.getValueAt(selectedRow, 4)+"ZX "+sellSeatNum+"<br>日期: "+modifyDate+"</html>") ;
				this.query() ;//更新
			}else {
				JOptionPane.showMessageDialog(null, "改签失败!") ;
				return ;
			}
		}
	}

	public void query(){

		//产生一个jtable
		jTable = new JTable() ;
		jTable.setRowHeight(50) ;
		jTable.setBackground(new Color(0xA9CAF3)) ;
		//根据票的id查出航班的出发时间 
		unButton.setEnabled(true) ;
		Vector<String> flightIds= dataHandle.queryStringVector("select t_f_number from tickets where t_uid=?", new String[]{user.getU_id()}) ;
		if(flightIds.size()==0){
			//表示这个Id号没有票
			//表示没有直达的飞机
			JLabel jLabel = new JLabel("对不起!!您还没有订任何票",JLabel.CENTER) ;
			jLabel.setFont(Tookit.getFont5()) ;
			jLabel.setFont(Tookit.getFont2()) ;
			jsp.setViewportView(jLabel) ;
			//预订按钮不可见
			unButton.setEnabled(false) ;
			card.show(iPanel, "two") ;
			return ;
		}
		//这里可以 改为FlihtInfo信息-----------------------------
		Vector<String> startTimes = new Vector<String>() ;
		for(String flightId:flightIds){
			String startTime = dataHandle.queryOneString("select f_start_time from flight_info where f_number=?", new String[]{flightId}) ;
			startTimes.add(startTime) ;
		}
		ReturnTicketModel returnTicketModel = new ReturnTicketModel("select * from tickets where t_uid=?",new String[]{user.getU_id()},user,startTimes) ;
		jTable.setModel(returnTicketModel) ;
		jsp.setViewportView(jTable) ;
		card.show(iPanel, "two") ;
	
	}


}

User

package com.sjsq.bean;

public class User {

	private String u_id ;  //用户名 主键
	private String  u_password ;           //密码
	private String  u_name ;  //用户姓名
	private String  u_sex ;//用户姓名
	public User(String uId, String uPassword, String uName, String uSex,
			String uTelephone, String uAddress, String uEmail, String uIdcard,
			String uPower) {
		super();
		u_id = uId;
		u_password = uPassword;
		u_name = uName;
		u_sex = uSex;
		u_telephone = uTelephone;
		u_address = uAddress;
		u_email = uEmail;
		u_idcard = uIdcard;
		u_power = uPower;
	}
	private String  u_telephone ;    //电话
	private String  u_address ;  //用户地址
	private String  u_email ;   //Email 
	private String u_idcard ;  //身份证号
	private String  u_power ;     //用户的权限  1表示机场人员,0表示旅客
	public String getU_id() {
		return u_id;
	}
	public void setU_id(String uId) {
		u_id = uId;
	}
	public String getU_password() {
		return u_password;
	}
	public void setU_password(String uPassword) {
		u_password = uPassword;
	}
	public String getU_name() {
		return u_name;
	}
	public void setU_name(String uName) {
		u_name = uName;
	}
	public String getU_sex() {
		return u_sex;
	}
	public void setU_sex(String uSex) {
		u_sex = uSex;
	}
	public String getU_telephone() {
		return u_telephone;
	}
	public void setU_telephone(String uTelephone) {
		u_telephone = uTelephone;
	}
	public String getU_address() {
		return u_address;
	}
	public void setU_address(String uAddress) {
		u_address = uAddress;
	}
	public String getU_email() {
		return u_email;
	}
	public void setU_email(String uEmail) {
		u_email = uEmail;
	}
	public String getU_idcard() {
		return u_idcard;
	}
	public void setU_idcard(String uIdcard) {
		u_idcard = uIdcard;
	}
	public String getU_power() {
		return u_power;
	}
	public void setU_power(String uPower) {
		u_power = uPower;
	}
	@Override
	public String toString() {
		return "User [u_address=" + u_address + ", u_email=" + u_email
				+ ", u_id=" + u_id + ", u_idcard=" + u_idcard + ", u_name="
				+ u_name + ", u_password=" + u_password + ", u_power="
				+ u_power + ", u_sex=" + u_sex + ", u_telephone=" + u_telephone
				+ "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((u_address == null) ? 0 : u_address.hashCode());
		result = prime * result + ((u_email == null) ? 0 : u_email.hashCode());
		result = prime * result + ((u_id == null) ? 0 : u_id.hashCode());
		result = prime * result
				+ ((u_idcard == null) ? 0 : u_idcard.hashCode());
		result = prime * result + ((u_name == null) ? 0 : u_name.hashCode());
		result = prime * result
				+ ((u_password == null) ? 0 : u_password.hashCode());
		result = prime * result + ((u_power == null) ? 0 : u_power.hashCode());
		result = prime * result + ((u_sex == null) ? 0 : u_sex.hashCode());
		result = prime * result
				+ ((u_telephone == null) ? 0 : u_telephone.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (u_address == null) {
			if (other.u_address != null)
				return false;
		} else if (!u_address.equals(other.u_address))
			return false;
		if (u_email == null) {
			if (other.u_email != null)
				return false;
		} else if (!u_email.equals(other.u_email))
			return false;
		if (u_id == null) {
			if (other.u_id != null)
				return false;
		} else if (!u_id.equals(other.u_id))
			return false;
		if (u_idcard == null) {
			if (other.u_idcard != null)
				return false;
		} else if (!u_idcard.equals(other.u_idcard))
			return false;
		if (u_name == null) {
			if (other.u_name != null)
				return false;
		} else if (!u_name.equals(other.u_name))
			return false;
		if (u_password == null) {
			if (other.u_password != null)
				return false;
		} else if (!u_password.equals(other.u_password))
			return false;
		if (u_power == null) {
			if (other.u_power != null)
				return false;
		} else if (!u_power.equals(other.u_power))
			return false;
		if (u_sex == null) {
			if (other.u_sex != null)
				return false;
		} else if (!u_sex.equals(other.u_sex))
			return false;
		if (u_telephone == null) {
			if (other.u_telephone != null)
				return false;
		} else if (!u_telephone.equals(other.u_telephone))
			return false;
		return true;
	}
}

Seat

package com.sjsq.bean;

public class Seat {

	 private FlightInfo fInfo ;//航班号  
     private String s_type ;//舱位类型
	 private String s_number ;//每个航班对就舱位的数量
	public Seat(FlightInfo fInfo, String sType, String sNumber, double sPrice) {
		super();
		this.fInfo = fInfo;
		s_type = sType;
		s_number = sNumber;
		s_price = sPrice;
	}
	private double s_price ;//对应舱位的价格
	public FlightInfo getfInfo() {
		return fInfo;
	}
	public void setfInfo(FlightInfo fInfo) {
		this.fInfo = fInfo;
	}
	public String getS_type() {
		return s_type;
	}
	public void setS_type(String sType) {
		s_type = sType;
	}
	public String getS_number() {
		return s_number;
	}
	public void setS_number(String sNumber) {
		s_number = sNumber;
	}
	public double getS_price() {
		return s_price;
	}
	public void setS_price(double sPrice) {
		s_price = sPrice;
	}
	@Override
	public String toString() {
		return "Seat [fInfo=" + fInfo + ", s_number=" + s_number + ", s_price="
				+ s_price + ", s_type=" + s_type + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((fInfo == null) ? 0 : fInfo.hashCode());
		result = prime * result
				+ ((s_number == null) ? 0 : s_number.hashCode());
		long temp;
		temp = Double.doubleToLongBits(s_price);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + ((s_type == null) ? 0 : s_type.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Seat other = (Seat) obj;
		if (fInfo == null) {
			if (other.fInfo != null)
				return false;
		} else if (!fInfo.equals(other.fInfo))
			return false;
		if (s_number == null) {
			if (other.s_number != null)
				return false;
		} else if (!s_number.equals(other.s_number))
			return false;
		if (Double.doubleToLongBits(s_price) != Double
				.doubleToLongBits(other.s_price))
			return false;
		if (s_type == null) {
			if (other.s_type != null)
				return false;
		} else if (!s_type.equals(other.s_type))
			return false;
		return true;
	}
	

}

Bank

package com.sjsq.bean;

import java.io.Serializable;

public class Bank implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int b_id ;
    private String b_name ;
    private String b_u_name ;
    private String b_u_card ;
    private String b_account ;
    private String b_balance ;
	public Bank(int bId, String bName, String bUName, String bUCard,
			String bAccount, String bBalance) {
		super();
		b_id = bId;
		b_name = bName;
		b_u_name = bUName;
		b_u_card = bUCard;
		b_account = bAccount;
		b_balance = bBalance;
	}
	public int getB_id() {
		return b_id;
	}
	public void setB_id(int bId) {
		b_id = bId;
	}
	public String getB_name() {
		return b_name;
	}
	public void setB_name(String bName) {
		b_name = bName;
	}
	public String getB_u_name() {
		return b_u_name;
	}
	public void setB_u_name(String bUName) {
		b_u_name = bUName;
	}
	public String getB_u_card() {
		return b_u_card;
	}
	public void setB_u_card(String bUCard) {
		b_u_card = bUCard;
	}
	public String getB_account() {
		return b_account;
	}
	public void setB_account(String bAccount) {
		b_account = bAccount;
	}
	public String getB_balance() {
		return b_balance;
	}
	public void setB_balance(String bBalance) {
		b_balance = bBalance;
	}
	@Override
	public String toString() {
		return "Bank [b_account=" + b_account + ", b_balance=" + b_balance
				+ ", b_id=" + b_id + ", b_name=" + b_name + ", b_u_card="
				+ b_u_card + ", b_u_name=" + b_u_name + "]";
	}
}

FlightAddr

package com.sjsq.bean;

public class FlightAddr {

	 private String a_id ;  //序列进行  拼接
	 private String  a_city ;   // 地点
	 public FlightAddr(String aId, String aCity, String aAir) {
		super();
		a_id = aId;
		a_city = aCity;
		a_air = aAir;
	}
	private String  a_air ;  //机场名称
	public String getA_id() {
		return a_id;
	}
	public void setA_id(String aId) {
		a_id = aId;
	}
	public String getA_city() {
		return a_city;
	}
	public void setA_city(String aCity) {
		a_city = aCity;
	}
	public String getA_air() {
		return a_air;
	}
	public void setA_air(String aAir) {
		a_air = aAir;
	}
	@Override
	public String toString() {
		return "FlightAddr [a_air=" + a_air + ", a_city=" + a_city + ", a_id="
				+ a_id + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((a_air == null) ? 0 : a_air.hashCode());
		result = prime * result + ((a_city == null) ? 0 : a_city.hashCode());
		result = prime * result + ((a_id == null) ? 0 : a_id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FlightAddr other = (FlightAddr) obj;
		if (a_air == null) {
			if (other.a_air != null)
				return false;
		} else if (!a_air.equals(other.a_air))
			return false;
		if (a_city == null) {
			if (other.a_city != null)
				return false;
		} else if (!a_city.equals(other.a_city))
			return false;
		if (a_id == null) {
			if (other.a_id != null)
				return false;
		} else if (!a_id.equals(other.a_id))
			return false;
		return true;
	}
}

FlightInfo

package com.sjsq.bean;

public class FlightInfo {

	private String f_number; //航班号
    private String f_type ;   //航班机型
	public FlightInfo(String fNumber, String fType, String fStartTime,
			String fEndTime, FlightAddr fStart, FlightAddr fEnd, String fCompany) {
		super();
		f_number = fNumber;
		f_type = fType;
		f_start_time = fStartTime;
		f_end_time = fEndTime;
		f_start = fStart;
		f_end = fEnd;
		f_company = fCompany;
	}
	private String  f_start_time ;//出发时间
	private String  f_end_time ;  //达到时间
	private FlightAddr  f_start ;   //始发机场  
	private FlightAddr  f_end ;     //目的地
	private String f_company ;
	public String getF_number() {
		return f_number;
	}
	public void setF_number(String fNumber) {
		f_number = fNumber;
	}
	public String getF_type() {
		return f_type;
	}
	public void setF_type(String fType) {
		f_type = fType;
	}
	public String getF_start_time() {
		return f_start_time;
	}
	public void setF_start_time(String fStartTime) {
		f_start_time = fStartTime;
	}
	public String getF_end_time() {
		return f_end_time;
	}
	public void setF_end_time(String fEndTime) {
		f_end_time = fEndTime;
	}
	public FlightAddr getF_start() {
		return f_start;
	}
	public void setF_start(FlightAddr fStart) {
		f_start = fStart;
	}
	public FlightAddr getF_end() {
		return f_end;
	}
	public void setF_end(FlightAddr fEnd) {
		f_end = fEnd;
	}
	public String getF_company() {
		return f_company;
	}
	public void setF_company(String fCompany) {
		f_company = fCompany;
	}
	@Override
	public String toString() {
		return "FlightInfo [f_company=" + f_company + ", f_end=" + f_end
				+ ", f_end_time=" + f_end_time + ", f_number=" + f_number
				+ ", f_start=" + f_start + ", f_start_time=" + f_start_time
				+ ", f_type=" + f_type + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((f_company == null) ? 0 : f_company.hashCode());
		result = prime * result + ((f_end == null) ? 0 : f_end.hashCode());
		result = prime * result
				+ ((f_end_time == null) ? 0 : f_end_time.hashCode());
		result = prime * result
				+ ((f_number == null) ? 0 : f_number.hashCode());
		result = prime * result + ((f_start == null) ? 0 : f_start.hashCode());
		result = prime * result
				+ ((f_start_time == null) ? 0 : f_start_time.hashCode());
		result = prime * result + ((f_type == null) ? 0 : f_type.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FlightInfo other = (FlightInfo) obj;
		if (f_company == null) {
			if (other.f_company != null)
				return false;
		} else if (!f_company.equals(other.f_company))
			return false;
		if (f_end == null) {
			if (other.f_end != null)
				return false;
		} else if (!f_end.equals(other.f_end))
			return false;
		if (f_end_time == null) {
			if (other.f_end_time != null)
				return false;
		} else if (!f_end_time.equals(other.f_end_time))
			return false;
		if (f_number == null) {
			if (other.f_number != null)
				return false;
		} else if (!f_number.equals(other.f_number))
			return false;
		if (f_start == null) {
			if (other.f_start != null)
				return false;
		} else if (!f_start.equals(other.f_start))
			return false;
		if (f_start_time == null) {
			if (other.f_start_time != null)
				return false;
		} else if (!f_start_time.equals(other.f_start_time))
			return false;
		if (f_type == null) {
			if (other.f_type != null)
				return false;
		} else if (!f_type.equals(other.f_type))
			return false;
		return true;
	} 
}

LoginView

package com.sjsq.view;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Date;
import java.util.Vector;

import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.synth.Region;

import com.sjsq.bean.User;
import com.sjsq.dao.DbHandle;
import com.sjsq.model.CheckInfo;
import com.sjsq.model.DataHandle;
import com.sjsq.model.FileOperation;
import com.sjsq.tools.MyLoginPanel;
import com.sjsq.tools.Tookit;

public class LoginView extends JFrame implements MouseListener{
	
	private JTextField userNameField = null;
	private JPasswordField userPasswdField = null ;
    private  JPanel jp ;
    private FileOperation fileOperation  ;
    private Vector<String> loginNames ;
   // private JScrollPane autoTipPane ;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new LoginView().setVisible(true);
	}
	
	public LoginView(){
		UIManager.put("TextField.font", Tookit.getFont1()) ;
		UIManager.put("Label.font", Tookit.getFont1()) ;
		UIManager.put("Button.font", Tookit.getFont1()) ;
		fileOperation = new FileOperation();
		//从文件中加载用户名过来
		loginNames = fileOperation.loading("path/loginName") ;
		this.init();
	}

	private void init() {
		//上面 的panel
		JPanel top = new JPanel() ;
		JLabel jTop = new JLabel(new ImageIcon("image/logo.gif")) ;
		top.add(jTop) ;
		this.add(top,BorderLayout.NORTH) ;
		//下面的panel
		JPanel buttom = new JPanel(new BorderLayout()) ;
		//左边
		buttom.add(this.leftPanel()) ;
		//右边
		buttom.add(this.rightPanel(),BorderLayout.EAST);
		 
		this.add(buttom) ;
		this.setSize(823, 500) ;
		this.setLocationRelativeTo(null) ;
		this.setResizable(false) ;
		this.setIconImage(new ImageIcon("image/1.png").getImage()) ;
		this.setTitle("飞机订票系统") ;
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ;
	}
	/**
	 * 处理左边登录面板
	 * @return
	 */
	public JPanel leftPanel(){
		JPanel jPanel = new JPanel(new BorderLayout()) ;
		//上面
		JLabel jLogin = new JLabel(new ImageIcon("image/enter_font1.jpg"),JLabel.CENTER) ;
		jPanel.add(jLogin,BorderLayout.NORTH) ;//加一个jlable
		//中间
		MyLoginPanel myPanel = new MyLoginPanel() ;
		myPanel.setLayout(null) ;
	
		final JLabel userName = new JLabel("登录名:",JLabel.CENTER) ;
		userName.setBounds(135, 70, 65, 15) ;
		userName.setFont(Tookit.getFont1()) ;
		myPanel.add(userName) ;
		//加一个面板   可以 存入多个jlabel
		jp = new JPanel() ;
		jp.setOpaque(false) ;
		//jp.setPreferredSize(new Dimension(140, 200)) ;
		//autoTipPane = new JScrollPane(jp) ;
		jp.setBounds(200, 89, 140, 200) ;
		//autoTipPane.setOpaque(false) ;
		//autoTipPane.getViewport().setOpaque(false) ;
		myPanel.add(jp) ;
		userNameField = new JTextField(12) ;
		userNameField.setBounds(200, 68, 140, 21) ;
		
		userNameField.getDocument().addDocumentListener(new DocumentListener() {
			
			//创建一个存入 jlabel的集合
			//Vector<JLabel> jLabels = new Vector<JLabel>() ;
			
			@Override
			public void removeUpdate(DocumentEvent e) {
				//每删除一个 字母
				LoginView.this.autoTip() ;
			}
			
			@Override
			public void insertUpdate(DocumentEvent e) {
				
				LoginView.this.autoTip() ;
			}
			
			@Override
			public void changedUpdate(DocumentEvent e) {
					
			}
		}) ;
		
		myPanel.add(userNameField) ;
		if(userNameField.getText().trim().equals("")){
			
		}
//		center.add(userName) ;
//		center.add(userNameField) ;
		JLabel userPasswd = new JLabel("密    码:",JLabel.CENTER) ;
		userPasswd.setFont(Tookit.getFont1()) ;
		userPasswd.setBounds(135, 124, 65, 15) ;
		userPasswdField = new JPasswordField(12) ;
		userPasswdField.setBounds(200, 124, 140, 21) ;
		myPanel.add(userPasswd) ;
		myPanel.add(userPasswdField) ;
		
		JLabel userGrade = new JLabel("身    份:",JLabel.CENTER) ;
		userGrade.setFont(Tookit.getFont1()) ;
		userGrade.setBounds(135, 166, 65, 15) ;
		final JComboBox jcb = new JComboBox(new String[]{"旅客","管理员"}) ;
		jcb.setBounds(200, 163, 71, 27) ;
		myPanel.add(userGrade) ;
		jcb.setFont(Tookit.getFont1()) ;
		myPanel.add(jcb) ;

		JButton login = new JButton("登录");
		login.setBounds(151, 215, 81, 30) ;
		myPanel.add(login) ;
		login.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {

				//取出用户名跟密码以及角色
				if(userName.getText().trim().equals("") ||String.valueOf(userPasswdField.getPassword()).trim().equals("")){
					JOptionPane.showMessageDialog(LoginView.this, "用户名或密码不能为空!!") ;
					return ;
				}
				//发送数据到数据库验证  数据库处理   
				DataHandle loginHandle = new DataHandle() ;
				//权限
				String power = ((String)jcb.getSelectedItem()).equals("旅客")?"0":"1" ;
				//用户名
				String userId = userNameField.getText().trim() ;
				//密码
				String userPasswd = String.valueOf(userPasswdField.getPassword()) ;
				User user = loginHandle.getUser(
						"select * from users where u_id=?",
						new String[] { userId });
				if(user!=null && user.getU_password().equals(userPasswd) && user.getU_power().equals(power)){
					//表示验证成功
					//得到用户姓名
					String userName = user.getU_name() ;
					String userSex = user.getU_sex() ;
					String userCall = userSex.equals("男")?"先生":"女士" ;
					if(power.equals("0")){
						//表示旅客
						JOptionPane.showMessageDialog(LoginView.this, "欢迎旅客"+userName+userCall+"登录") ;
						new GuestMainView(user).setVisible(true) ;
					}else {
						JOptionPane.showMessageDialog(LoginView.this, "欢迎管理员"+userName+userCall+"登录") ;
						new MangerMainView(user).setVisible(true) ;
					}
					//登录成功  将用户名加入到集合里  
					if(!loginNames.contains(userId)){
						//表示文件这个Id不存在
						loginNames.add(userId) ;
					}
					//序列到文件
					boolean b = fileOperation.save("path/loginName", loginNames) ;
					if(!b){
						JOptionPane.showMessageDialog(LoginView.this, "序列化文件失败");
						return ;
					}
					LoginView.this.dispose() ;
					
				}else{
					//验证不成功
					JOptionPane.showMessageDialog(LoginView.this, "用户名、密码与身份不匹配!!") ;
					userPasswdField.setText("") ;
				}
				
			}
		}) ;
		login.setPreferredSize(new Dimension(80, 30)) ;
		login.setBackground(new Color(0x71B8EC)) ;
		JButton exit = new JButton("退出");
		exit.setBounds(265, 215, 81, 30) ;
		myPanel.add(exit) ;
		exit.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				//可以在这里加一个滚动条  ??
				System.exit(0) ;
			}
		}) ;
		exit.setPreferredSize(new Dimension(80, 30)) ;
		exit.setBackground(new Color(46,116,188)) ;
		jPanel.add(myPanel) ;
		return jPanel ;
	}
/**
 * 将右边设置为卡片布局
 * @return
 */
	public JPanel rightPanel(){
		
		final CardLayout card = new CardLayout() ;
		final JPanel right = new JPanel(card) ;
		right.setBorder(new TitledBorder(new EtchedBorder(), "新用户注册")) ;
		right.setPreferredSize(new Dimension(269, 363)) ;
		//right.setBackground(new Color(0xFFFFCC)) ;
		
		Box box = Box.createVerticalBox() ;
		box.add(Box.createHorizontalStrut(32)) ;
		
		JLabel jLabel = new JLabel() ;
		jLabel.setText("<html>" +"<h2>新用户注册</h2><hr>"+
				"1、免费注册<br> 2、实名注册 <br>3、注册用户可享受个性化服务<br><br> " +
				"</html>") ;
		box.add(jLabel) ;
		
		JButton regist = new JButton("注册") ;
		regist.setPreferredSize(new Dimension(100, 30)) ;
		regist.setBackground(new Color(0xFFFFCC)) ;
		box.add(regist) ;
		JPanel jpOne = new JPanel() ;
		jpOne.setOpaque(false) ;
		jpOne.add(box) ;
		right.add(jpOne,"one") ;
		//第二个panel
		JPanel jpTwo = new JPanel() ;
		jpTwo.setOpaque(false) ;
		jpTwo.setLayout(new BorderLayout()) ;
		String info ="<html>1、服务条款的确认<br>您点击服务条款页面下的“我同意”按钮,<br>即视为您已阅读、了解并完全同意服务条款<br>中的各项内容,包括本网站对服务条款所<br>作的任何修改。除另行明确声明外,本网站<br>任何服务范围或功能的变化均受服务条款约束。<br>2、服务条款的修改<br>本网站在必要时可修改服务条款,并在网站<br>进行公告,一经公告,立即生效。如您继续<br>使用服务,则视为您已接受修订的服务条款。<br>3、用户注册<br>考虑到本网站用户服务的重要性,您同意在<br>注册时提供真实、完整及准确的个人资料,<br>并及时更新。 如您提供的资料不准确,或<br>本网站有合理的理由认为该资料不真实、不<br>完整、不准确,本网站有权暂停或终止您的<br>注册身份及资料,并拒绝您<br>使用本网站的服务。4、用户资料及保密<br>注册时,请您选择填写用户名和密码,<br>并按页面提示提交相关信息。您负有对用户<br>名和密码保密的义务,并对该用户名和密<br>码下发生的所有活动承担责任。您同意邮件<br>服务的使用由您自己承担风险。本网站不<br>会向您所使用服务所涉及相关方之外的其他<br>方公开或透露您的个人资料,法律法规规定除外。 <html>" ;
		JLabel jLabel2 = new JLabel(info) ;
		jLabel2.setFont(Tookit.getFont1()) ;
		jpTwo.add(jLabel2) ;
		JPanel jpButton = new JPanel() ;
		jpButton.setOpaque(false) ;
		JButton accept = new JButton("同意") ;
		accept.setPreferredSize(new Dimension(100, 30)) ;
		accept.setBackground(new Color(0xFFFFCC)) ;
		jpButton.add(accept) ;
		JButton unaccept = new JButton("不同意") ;
		unaccept.setPreferredSize(new Dimension(100, 30)) ;
		unaccept.setBackground(new Color(0xFFFFCC)) ;
		jpButton.add(unaccept) ;
		jpTwo.add(jpButton,BorderLayout.SOUTH);
		right.add(new JScrollPane(jpTwo),"two") ;
		//第三个panel
		JPanel jpThree = new JPanel(new BorderLayout()) ;
		//jpThree.setOpaque(false) ;
		//jpThree.setPreferredSize(new Dimension(269,300)) ;
		JPanel infoPanel = new JPanel(new GridLayout(9, 2)) ;
		JLabel userId = new JLabel("用户名:",JLabel.CENTER);
		userId.setFont(Tookit.getFont1()) ;
		infoPanel.add(userId) ;
		final JTextField userIdField = new JTextField() ;
		infoPanel.add(userIdField) ;
		JLabel userPasswd = new JLabel("密码:",JLabel.CENTER);
		userPasswd.setFont(Tookit.getFont1()) ;
		infoPanel.add(userPasswd) ;
		final JPasswordField userPasswdField = new JPasswordField() ;
		infoPanel.add(userPasswdField) ;
		JLabel userPasswd1 = new JLabel("确认密码:",JLabel.CENTER);
		userPasswd1.setFont(Tookit.getFont1()) ;
		infoPanel.add(userPasswd1) ;
		final JPasswordField userPasswd1Field = new JPasswordField() ;
		infoPanel.add(userPasswd1Field) ;
		JLabel userName = new JLabel("姓   名:",JLabel.CENTER);
		userName.setFont(Tookit.getFont1()) ;
		infoPanel.add(userName) ;
		final JTextField userNameField = new JTextField() ;
		infoPanel.add(userNameField) ;
		//用户性别
		JLabel userSex = new JLabel("性别:",JLabel.CENTER) ;
		userSex.setFont(Tookit.getFont1()) ;
		JPanel jSex = new JPanel() ;
		jSex.setOpaque(false) ;
		final JRadioButton boy = new JRadioButton("男") ;
		boy.setOpaque(false) ;
		boy.setFont(Tookit.getFont1()) ;
		final JRadioButton girl = new JRadioButton("女") ;
		girl.setOpaque(false) ;
		girl.setFont(Tookit.getFont1()) ;
		ButtonGroup gbGroup = new ButtonGroup();
		gbGroup.add(boy) ;
		gbGroup.add(girl) ;
		jSex.add(boy) ;
		jSex.add(girl) ;
		infoPanel.add(userSex);
		infoPanel.add(jSex) ;
		JLabel tel = new JLabel("电话号码:",JLabel.CENTER);
		tel.setFont(Tookit.getFont1()) ;
		infoPanel.add(tel) ;
		final JTextField telField = new JTextField() ;
		infoPanel.add(telField) ;
		JLabel addr = new JLabel("地址:",JLabel.CENTER);
		addr.setFont(Tookit.getFont1()) ;
		infoPanel.add(addr) ;
		final JTextField addrField = new JTextField() ;
		infoPanel.add(addrField) ;
		JLabel email = new JLabel("电子邮件:",JLabel.CENTER);
		email.setFont(Tookit.getFont1()) ;
		infoPanel.add(email) ;
		final JTextField emailField = new JTextField() ;
		infoPanel.add(emailField) ;
		JLabel identity = new JLabel("身份证号:",JLabel.CENTER);
		identity.setFont(Tookit.getFont1()) ;
		infoPanel.add(identity) ;
		final JTextField identityField = new JTextField() ;
		infoPanel.add(identityField) ;
		jpThree.add(infoPanel) ;

		JPanel subMitPanel = new JPanel() ;
		JButton submit = new JButton("提交注册信息") ;
		submit.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				//得到所有的数据   9个数据
				String uId=userIdField.getText().trim();
				String uPassword=String.valueOf(userPasswdField.getPassword());
				String uName = userNameField.getText().trim();
				String uSex  = null;
				if(boy.isSelected()){
					uSex=boy.getText().trim();
				}
				if(girl.isSelected()){
					uSex=girl.getText().trim();
				}
				String uTelephone=telField.getText().trim();
				String uAddress  =addrField.getText().trim();
				String uEmail   = emailField.getText().trim();
				String uIdcard = identityField.getText().trim();
				
				//判断所有的是否为空
				if(uId.isEmpty()||uPassword.isEmpty()||userPasswd1Field.getPassword().toString().equals("")||uName.isEmpty()||uSex.isEmpty()||uTelephone.isEmpty()||uAddress.isEmpty()||uEmail.isEmpty()||uIdcard.isEmpty()){
					JOptionPane.showMessageDialog(null, "所填项不能为空!");
					return;
				}
				System.out.println(String.valueOf(userPasswd1Field.getPassword())+"-------"+uPassword);
				//做出判断   二次密码是 不是一样
				if(String.valueOf(userPasswd1Field.getPassword()).equals(uPassword)==false){
					JOptionPane.showMessageDialog(null, "两次密码不一致!");
					return;
				}
				//创建一个User
				User user = new User(uId, uPassword, uName, uSex, uTelephone, uAddress, uEmail, uIdcard, "0");
				CheckInfo checkInfo =new CheckInfo() ;
				boolean b = checkInfo.checkRegistInfo(user) ;
				System.out.println(b);
				if(b==true){
					//表示 数据 格式 是 正确的  此时连接数据库操作
					String sql="insert into users values(?,?,?,?,?,?,?,?,?)";
					String[] ss={uId, uPassword, uName, uSex, uTelephone, uAddress, uEmail, uIdcard, 0+""};
					
					DataHandle dataHandle=new DataHandle();
					boolean iss=dataHandle.update(sql, ss);
					if(iss){
						 JOptionPane.showConfirmDialog(null, "注册成功!是否继续?");
						card.show(right, "one") ;
					}else{
						JOptionPane.showMessageDialog(null, "注册失败!");
						return;
					}
				}	
//				}else{
//					JOptionPane.showMessageDialog(null, "格式不正确");
//				}
			}
		}) ;
		submit.setFont(Tookit.getFont1()) ;
		//submit.setPreferredSize(new Dimension(100, 30)) ;
		submit.setBackground(new Color(0xFFFFCC)) ;
		subMitPanel.add(submit) ;
		JButton reset = new JButton("重置") ;
		reset.setFont(Tookit.getFont1()) ;
		reset.setPreferredSize(new Dimension(100, 30)) ;
		reset.setBackground(new Color(0xFFFFCC)) ;
		subMitPanel.add(reset) ;
		jpThree.add(subMitPanel,BorderLayout.SOUTH) ;
		right.add(jpThree,"three") ;
		
		reset.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				userIdField.setText("") ;
				userNameField.setText("") ;
				userPasswdField.setText("") ;
				userPasswd1Field.setText("") ;
				telField.setText("") ;
				addrField.setText("") ;
				emailField.setText("") ;
				identityField.setText("") ;
			}
		}) ;
		regist.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				//点击了注册 
				card.show(right, "two") ;
			}
		}) ;
		accept.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				card.show(right, "three") ;
			}
		}) ;
		unaccept.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				card.show(right, "one") ;
			}
		}) ;
		return right ;
	}
	
	public void autoTip(){
		System.out.println("===");
		//清除面板所有 的 组件
		jp.removeAll() ;
		//jLabels.removeAllElements() ;
		//得到 文本域 的名
		String str = userNameField.getText().trim() ;
		
		for(String loginName :loginNames){
			if(loginName.startsWith(str) && !str.equals("")){
				//创建一个jlabel
				JLabel jLabel = new JLabel(loginName) ;
				jLabel.addMouseListener(LoginView.this) ;
				jLabel.setPreferredSize(new Dimension(140, 20));
				//jLabels.add(jLabel) ;
				jp.add(jLabel) ;	
			}
		}
		jp.repaint() ;
		//autoTipPane.repaint() ;
		jp.validate() ;//刷新界面
	//	autoTipPane.validate() ;
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		
		userNameField.setText(((JLabel)e.getSource()).getText()) ;
		//设置面板属性	
		jp.removeAll() ;
		this.remove(jp) ;
		this.repaint() ;
		this.validate() ;

		//设置面板的宽度
		//jp.setBackground(Color.red) ;
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		JLabel jLabel = (JLabel)e.getSource() ;
		jLabel.setForeground(Tookit.getColor()) ;
		jLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		JLabel jLabel = (JLabel)e.getSource() ;
		jLabel.setForeground(Color.black) ;
		jLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)) ;
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
}

GuestMainView

 

package com.sjsq.view;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Menu;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.util.Date;

import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.UIManager;
import javax.tools.Tool;

import com.sjsq.bean.User;
import com.sjsq.tools.ImagePanel;
import com.sjsq.tools.Tookit;

public class GuestMainView extends JFrame implements Runnable, MouseListener, ActionListener {

	private JMenuBar jmBar = null;
	private JLabel timeLabel = null;
	private CardLayout card = null;
	private JSplitPane jsp = null;
	private JPanel rightPanel = null;
	private JLabel[] jLabels = null;
	private User user = null;

//	public static void main(String[] args) {
//		GuestMainView mainView = new GuestMainView();
//		mainView.setVisible(true) ;
//		//mainView.run() ;
//	}
	public GuestMainView(User user) {
		this.user = user;
		this.init();

	}

	public void initTi() {
		try {
			// 判断当前平台是否支持系统托盘
			if (SystemTray.isSupported()) {
				// 获得系统托盘
				SystemTray st = SystemTray.getSystemTray();

				// 新建一个系统托盘按钮并制定图片
				Image image = Toolkit.getDefaultToolkit().getImage("image/1.png");// 定义托盘图标的图片
				TrayIcon ti = new TrayIcon(image);

				// 定义这个新建的托盘按钮
				ti.setToolTip("打开系统");
				ti.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent e) {
						if (e.getButton() == MouseEvent.BUTTON1)// 鼠标左键单击,打开窗体
							GuestMainView.this.setVisible(true);
						GuestMainView.this.setExtendedState(JFrame.NORMAL);
					}
				});
				PopupMenu p = new PopupMenu("OK");

				MenuItem m1 = new MenuItem("打开");
				m1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						GuestMainView.this.setVisible(true);
						GuestMainView.this.setExtendedState(JFrame.NORMAL);
					}
				});
				p.add(m1);
				p.addSeparator();
				MenuItem m = new MenuItem("退出");
				m.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						System.exit(0);
					}
				});
				p.add(m);
				ti.setPopupMenu(p); // 为托盘添加右键菜单

				// 将定义好的托盘按钮绑定到系统图盘上
				st.add(ti);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void init() {
		// 修改默认字体
		UIManager.put("Menu.font", Tookit.getFont1());
		UIManager.put("MenuItem.font", Tookit.getFont1());
		UIManager.put("MenuBar.background", new Color(0x498DF8));
		// 加菜单项
		this.setJMenuBar(this.initMenu());
		// 中间面板
		this.add(this.initCenterPanel());
		this.setIconImage(new ImageIcon("image/1.png").getImage());
		// 下面面板
		this.add(this.buttonPanel(), BorderLayout.SOUTH);
		
		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
		//this.setSize(dimension.width - 80, dimension.height - 30);
		this.setSize(1200, 700);
		this.setTitle("航空订票系统");
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setLocationRelativeTo(null) ;
		// 托盘
		this.initTi();
	}

	/**
	 * 初始化中间的面板
	 * 
	 * @return
	 */
	public JSplitPane initCenterPanel() {
		card = new CardLayout();
		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();

		ImagePanel leftPanel = null;

		try {
			leftPanel = new ImagePanel(ImageIO.read(new File("image/171go.jpg")), dimension);
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} // 画主面板
		leftPanel.setLayout(new GridLayout(7, 1, 10, 10));// 左边为风格布局
		String info[] = { "系 统 简 介", "机 票 查 询", "改 签 处 理", "航 班 动 态", "退 票 处 理", "帮       助", "退 出 系 统" };
		jLabels = new JLabel[7];
		for (int i = 0; i < info.length; i++) {
			JLabel jLabel = new JLabel(info[i], JLabel.CENTER);
			jLabels[i] = jLabel;
			jLabel.setForeground(Tookit.getColor());
			jLabel.setEnabled(false);
			jLabel.addMouseListener(this);
			jLabel.setFont(Tookit.getFont6());
			leftPanel.add(jLabel);
		}

		rightPanel = new JPanel(card);// 右边设置为卡片布局
		// 创建一个机票查询面板
		TicketSearchPanel tsPanel = new TicketSearchPanel(user);
		rightPanel.add(tsPanel.getJPanel(), "tsPanel");
		// 创建一个取票查询面板
		ModifyTicketPanel gtqView = new ModifyTicketPanel(user);
		rightPanel.add(gtqView.getJPanel(), "gtqPanel");
		// 创建一个航班动态
		rightPanel.add(new PlaneStatePanel().getJPanel(), "pqPanel");
		// 创建一个退票处理面板
		rightPanel.add(new ReturnTicketPanel(user).getJPanel(), "rtPanel");
		// 创建一个系统介绍面板
		rightPanel.add(new Introduce(), "introduce");

		// 把二个加入到拆分 面板
		jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPanel, rightPanel);
		// 设置左边窗体的大小
		int w = Toolkit.getDefaultToolkit().getScreenSize().width;
		jsp.setDividerLocation(w);
		// 设置拆分窗体中间线的大小
		jsp.setDividerSize(0);
		// jsp.setEnabled(false) ;
		jsp.setOneTouchExpandable(true);// 有伸展条
		return jsp;
	}

	/**
	 * 初始化下面底部面板
	 * 
	 * @return
	 */
	public JPanel buttonPanel() {

		JPanel buttomPanel = new JPanel(new BorderLayout());

		buttomPanel.setBackground(new Color(0x498DF8));

		timeLabel = new JLabel();// 当前时间
		// 启动线程
		new Thread(this).start();
		buttomPanel.add(timeLabel, BorderLayout.EAST);
		JLabel jLabel = new JLabel("旅客:" + user.getU_name() + "登录");
		jLabel.setFont(Tookit.getFont1());
		buttomPanel.add(jLabel, BorderLayout.WEST);
		return buttomPanel;
	}

	/**
	 * 初始化菜单
	 * 
	 * @return
	 */
	public JMenuBar initMenu() {
		jmBar = new JMenuBar();
		// 用户菜单
		JMenu jm1 = new JMenu("用户");
		JMenu jm2 = new JMenu("航班在线");
		JMenu jm3 = new JMenu("航班操作");
		JMenu jm4 = new JMenu("帮助");
		JMenuItem jm1_1 = new JMenuItem("切换用户");
		jm1_1.addActionListener(this);
		JMenuItem jm1_2 = new JMenuItem("用户信息修改");
		jm1_2.addActionListener(this);
		JMenuItem jm1_3 = new JMenuItem("用户退出");
		jm1_3.addActionListener(this);
		jm1.add(jm1_1);
		jm1.add(jm1_2);
		jm1.add(jm1_3);

		JMenuItem jm2_1 = new JMenuItem("读取消息");
		jm2_1.addActionListener(this);
		JMenuItem jm2_2 = new JMenuItem("发送消息");
		jm2_1.addActionListener(this);
		jm2.add(jm2_1);
		jm2.add(jm2_2);

		JMenuItem jm3_1 = new JMenuItem("机票查询");
		jm3_1.addActionListener(this);
		JMenuItem jm3_2 = new JMenuItem("改签查询");
		jm3_2.addActionListener(this);
		JMenuItem jm3_3 = new JMenuItem("航班动态");
		jm3_3.addActionListener(this);
		JMenuItem jm3_4 = new JMenuItem("退票处理");
		jm3_4.addActionListener(this);
		jm3.add(jm3_1);
		jm3.add(jm3_2);
		jm3.add(jm3_3);
		jm3.add(jm3_4);

		JMenuItem jm4_1 = new JMenuItem("系统简介");
		jm4_1.addActionListener(this);
		JMenuItem jm4_2 = new JMenuItem("帮助");
		jm4_2.addActionListener(this);
		jm4.add(jm4_1);
		jm4.add(jm4_2);

		jmBar.add(jm1);
		jmBar.add(jm2);
		jmBar.add(jm3);
		jmBar.add(jm4);
		return jmBar;
	}

	@Override
	public void run() {

		while (true) {
			timeLabel.setText(Tookit.getCurrentTime());
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} // 睡一秒
		}

	}

	@Override
	public void mouseClicked(MouseEvent e) {
		System.out.println("-----");
		if (e.getSource() instanceof JLabel) {
			// 表示 是标签
			if (((JLabel) e.getSource()).getText().trim().equals("机 票 查 询")) {
				card.show(rightPanel, "tsPanel");
				jsp.setDividerSize(10);
				jsp.setDividerLocation(200);
			}
			if (((JLabel) e.getSource()).getText().trim().equals("改 签 处 理")) {
				card.show(rightPanel, "gtqPanel");
				jsp.setDividerSize(10);
				jsp.setDividerLocation(200);
			}
			if (((JLabel) e.getSource()).getText().trim().equals("航 班 动 态")) {
				card.show(rightPanel, "pqPanel");
				jsp.setDividerSize(10);
				jsp.setDividerLocation(200);
			}
			if (((JLabel) e.getSource()).getText().trim().equals("退 票 处 理")) {
				card.show(rightPanel, "rtPanel");
				jsp.setDividerSize(10);
				jsp.setDividerLocation(200);
			}
			if (((JLabel) e.getSource()).getText().trim().equals("退 出 系 统")) {
				// 退出系统
				int num = JOptionPane.showConfirmDialog(this, "是否真的退出系统?");
				if (num == JOptionPane.YES_OPTION) {
					// 退出系统
					System.exit(0);
				}
			}
			if (((JLabel) e.getSource()).getText().trim().equals("帮       助")) {
				// 退出系统
				HelpDialog helpDialog = new HelpDialog(this);
				helpDialog.setTitle("帮助");
			}
		}
		if (((JLabel) e.getSource()).getText().trim().equals("系 统 简 介")) {
			card.show(rightPanel, "introduce");
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200);
		}

	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// 将label变为可见
		for (int i = 0; i < jLabels.length; i++) {
			if (e.getSource() == jLabels[i]) {
				// 表示 点击到了哪一个
				jLabels[i].setEnabled(true);
				jLabels[i].setCursor(new Cursor(Cursor.HAND_CURSOR));// 为什么没有效果
				return;
			}
		}

	}

	@Override
	public void mouseExited(MouseEvent e) {

		for (int i = 0; i < jLabels.length; i++) {
			if (e.getSource() == jLabels[i]) {
				// 表示 点击到了哪一个
				jLabels[i].setEnabled(false);
				// jLabels[i].setCursor(new Cursor(Cursor.MOVE_CURSOR)) ;
				return;
			}
		}
	}

	@Override
	public void mousePressed(MouseEvent e) {

	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void actionPerformed(ActionEvent e) {

		// 表示 是标签
		if (e.getActionCommand().trim().equals("机票查询")) {
			card.show(rightPanel, "tsPanel");
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200);
		}
		if (e.getActionCommand().trim().equals("改签查询")) {
			card.show(rightPanel, "gtqPanel");
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200);
		}
		if (e.getActionCommand().trim().equals("航班动态")) {
			card.show(rightPanel, "pqPanel");
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200);
		}
		if (e.getActionCommand().trim().equals("退票处理")) {
			System.out.println("tuipaio");
			card.show(rightPanel, "rtPanel");
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200);
		}
		if (e.getActionCommand().trim().equals("用户退出")) {
			// 退出系统
			int num = JOptionPane.showConfirmDialog(this, "是否真的退出系统?");
			if (num == JOptionPane.YES_OPTION) {
				// 退出系统
				System.exit(0);
			}
		}
		if (e.getActionCommand().trim().equals("帮助")) {
			// 退出系统
			HelpDialog helpDialog = new HelpDialog(this);
			helpDialog.setTitle("帮助");
		}
		if (e.getActionCommand().trim().equals("切换用户")) {
			// 跳到登录页面
			System.out.println("====");
			new LoginView().setVisible(true);
			this.dispose();
		}
		if (e.getActionCommand().trim().equals("用户信息修改")) {
			// 跳到用户修改界面
			new Userinformodification(GuestMainView.this, user).setVisible(true);
			GuestMainView.this.dispose();
		}
		if (e.getActionCommand().trim().equals("系统简介")) {
			card.show(rightPanel, "introduce");
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200);
		}
	}
}

MangerMainView

package com.sjsq.view;

import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.UIManager;

import com.sjsq.bean.User;
import com.sjsq.tools.ImagePanel;
import com.sjsq.tools.Tookit;
/**
 * 
 * 管理员主页
 *
 */
public class MangerMainView extends JFrame implements Runnable,MouseListener,ActionListener{
	

	
	private JMenuBar jmBar = null ;
	private JLabel timeLabel = null ;
	private CardLayout card = null ;
	private JSplitPane jsp = null;
	private JPanel rightPanel = null ;
	private JLabel[] jLabels = null;
	private User user = null ;
//	private  TrayIcon ti ;
//	public static void main(String[] args) {
//		MangerMainView mainView = new MangerMainView("otcyan");
//		mainView.setVisible(true) ;
//		//mainView.run() ;
//	}
	public MangerMainView(User user){
		this.user = user ;
		this.init() ;
	}
	public void init(){
		//修改默认字体 
		UIManager.put("Menu.font", Tookit.getFont1()) ;
		UIManager.put("MenuItem.font", Tookit.getFont1()) ;
		UIManager.put("MenuBar.background", new Color(0x498DF8)) ;
		//加菜单项
		this.setJMenuBar(this.initMenu()) ;
		//中间面板
		this.add(this.initCenterPanel()) ;
		//下面面板 
		this.add(this.buttonPanel(),BorderLayout.SOUTH) ;
		
		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize() ;
		//this.setSize(dimension.width-80, dimension.height-30) ;
		
		this.setSize(1200, 750);
		
		this.setTitle("航空订票系统") ;
		this.setIconImage(new ImageIcon("image/1.png").getImage()) ;
		this.setDefaultCloseOperation(EXIT_ON_CLOSE) ;	
		this.setLocationRelativeTo(null);
//		//托盘
		this.initTi() ;
	}
	
	/**
	 * 初始化托盘
	 */
	public void initTi(){
		 try {  
             // 判断当前平台是否支持系统托盘  
             if (SystemTray.isSupported()) {  
                     // 获得系统托盘  
                     SystemTray st = SystemTray.getSystemTray();  

                     // 新建一个系统托盘按钮并制定图片  
                     Image image = Toolkit.getDefaultToolkit().getImage("image/1.png") ;// 定义托盘图标的图片  
                     TrayIcon ti = new TrayIcon(image);  

                     // 定义这个新建的托盘按钮  
                     ti.setToolTip("打开系统");  
                     ti.addMouseListener(new MouseAdapter() {  
                             public void mouseClicked(MouseEvent e) {  
                                     if (e.getButton() == MouseEvent.BUTTON1)// 鼠标左键单击,打开窗体  
                                             MangerMainView.this.setVisible(true);  
                                    MangerMainView.this.setExtendedState(JFrame.NORMAL);  
                             }  
                     });  
                     PopupMenu p = new PopupMenu("OK");  

                     MenuItem m1 = new MenuItem("打开");  
                     m1.addActionListener(new ActionListener() {  
                             public void actionPerformed(ActionEvent e) {  
                                    MangerMainView.this.setVisible(true);  
                                    MangerMainView.this.setExtendedState(JFrame.NORMAL);   
                             }  
                     });  
                     p.add(m1);  
                     p.addSeparator();  
                     MenuItem m = new MenuItem("退出");  
                     m.addActionListener(new ActionListener() {  
                             public void actionPerformed(ActionEvent e) {  
                                     System.exit(0);  
                             }  
                     });  
                     p.add(m);  
                     ti.setPopupMenu(p); // 为托盘添加右键菜单  

                     // 将定义好的托盘按钮绑定到系统图盘上  
                     st.add(ti);  
             }  
     } catch (Exception e) {  
             e.printStackTrace();  
     }  
	}

	/**
	 * 初始化中间的面板
	 * @return
	 */
	public JSplitPane initCenterPanel(){
		card = new CardLayout() ;
		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
		
		ImagePanel leftPanel = null;
		
		try {
			leftPanel = new ImagePanel(ImageIO.read(new File("image/171go.jpg")),dimension);
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}//画主面板
		leftPanel.setLayout(new GridLayout(7, 1, 10, 10)) ;//左边为风格布局
		String info[] ={"机 票 查 询","改 签 处 理","航 班 动 态","退 票 处 理","销 售 统 计","后 台 管 理","退 出 系 统"};
		jLabels = new JLabel[7] ;
		for (int i = 0; i < info.length; i++) {
			JLabel jLabel = new JLabel(info[i],JLabel.CENTER);
			jLabels[i] = jLabel ;
			jLabel.setForeground(Tookit.getColor()) ;
			jLabel.setEnabled(false) ;
			jLabel.addMouseListener(this) ;
			jLabel.setFont(Tookit.getFont6()) ;
			leftPanel.add(jLabel) ;
		}
		
		rightPanel = new JPanel(card) ;//右边设置为卡片布局
		//创建一个机票查询面板
		TicketSearchPanel tsPanel = new TicketSearchPanel(user) ;
		rightPanel.add(tsPanel.getJPanel(), "tsPanel") ;
		//创建一个取票查询面板
		ModifyTicketPanel gtqView = new ModifyTicketPanel(user) ;
		rightPanel.add(gtqView.getJPanel(),"gtqPanel") ;
		//创建一个航班动态
		rightPanel.add(new PlaneStatePanel().getJPanel(),"pqPanel") ;
		//创建一个退票处理面板
		rightPanel.add(new ReturnTicketPanel(user).getJPanel(),"rtPanel") ;
		//创建一个销售统计面板
		rightPanel.add(new SalesCountPanel().getiPanel(),"scPanel") ;
		//创建一个后台管理面板	
		rightPanel.add(new BackManagerPanel().getIp(),"bmPanel") ;
		//创建一个介绍面板
		rightPanel.add(new Introduce(),"introduce") ;
		
		//把二个加入到拆分 面板
		 jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,leftPanel,rightPanel) ;
		//设置左边窗体的大小
		int w=Toolkit.getDefaultToolkit().getScreenSize().width;
		jsp.setDividerLocation(w);
		//设置拆分窗体中间线的大小
		jsp.setDividerSize(0);
		//jsp.setEnabled(false) ;
		jsp.setOneTouchExpandable(true) ;//有伸展条
		return jsp ;
	}
	/**
	 * 初始化下面底部面板
	 * @return
	 */
	public JPanel buttonPanel(){
		
		JPanel buttomPanel = new JPanel(new BorderLayout()) ;
		
		buttomPanel.setBackground(new Color(0x498DF8)) ;
		
		 timeLabel= new  JLabel() ;//当前时间
		 //启动线程
		 new Thread(this).start() ;
		 buttomPanel.add(timeLabel,BorderLayout.EAST) ;
		 JLabel jLabel = new JLabel("管理员:"+user.getU_name()+"登录") ;
		 jLabel.setFont(Tookit.getFont1());
		 buttomPanel.add(jLabel,BorderLayout.WEST) ;
		return buttomPanel ;
	}
	/**
	 * 初始化菜单
	 * @return
	 */
	public JMenuBar initMenu(){
		jmBar = new JMenuBar() ;
		//用户菜单
		JMenu jm1 = new JMenu("用户") ;
		JMenu jm2 = new JMenu("航班在线") ;
		JMenu jm3 = new JMenu("航班管理") ;
		JMenu jm4 = new JMenu("航班操作") ;
		JMenu jm5 = new JMenu("帮助") ;
		JMenuItem jm1_1 = new JMenuItem("切换用户") ;
		jm1_1.addActionListener(this) ;
		JMenuItem jm1_2 = new JMenuItem("用户信息修改");
		jm1_2.addActionListener(this) ;
		JMenuItem jm1_3 = new JMenuItem("用户退出") ;
		jm1_3.addActionListener(this) ;
		jm1.add(jm1_1) ;
		jm1.add(jm1_2) ;
		jm1.add(jm1_3) ;
		
		JMenuItem jm2_1 = new JMenuItem("读取消息") ;
		jm2_1.addActionListener(this) ;
		JMenuItem jm2_2 = new JMenuItem("发送消息") ;
		jm2_2.addActionListener(this) ;
		jm2.add(jm2_1) ;
		jm2.add(jm2_2) ;
		
		JMenuItem jmi3_1 = new JMenuItem("创建航班") ;
		jmi3_1.addActionListener(this) ;
		jmi3_1.setActionCommand("back") ;
		JMenuItem jmi3_2 = new JMenuItem("取消航班") ;
		jmi3_2.addActionListener(this) ;
		jmi3_2.setActionCommand("back") ;
		JMenuItem jmi3_3 = new JMenuItem("航班修改") ;
		jmi3_3.addActionListener(this) ;
		jmi3_3.setActionCommand("back") ;
		JMenuItem jmi3_4 = new JMenuItem("航班动态修改") ;
		jmi3_4.addActionListener(this) ;
		jmi3_4.setActionCommand("back") ;
		jm3.add(jmi3_1) ;
		jm3.add(jmi3_2) ;
		jm3.add(jmi3_3) ;
		jm3.add(jmi3_4) ;
		
		JMenuItem jm4_1 = new JMenuItem("机票查询") ;
		jm4_1.addActionListener(this) ;
		JMenuItem jm4_2 = new JMenuItem("改签查询") ;
		jm4_2.addActionListener(this) ;
		JMenuItem jm4_3 = new JMenuItem("航班动态") ;
		jm4_3.addActionListener(this) ;
		JMenuItem jm4_4 = new JMenuItem("退票处理") ;
		jm4_4.addActionListener(this) ;
		jm4.add(jm4_1) ;
		jm4.add(jm4_2) ;
		jm4.add(jm4_3) ;
		jm4.add(jm4_4) ;
		
		JMenuItem jm5_1 = new JMenuItem("系统简介") ;
		jm5_1.addActionListener(this) ;
		JMenuItem jm5_2 = new JMenuItem("帮助") ;
		jm5_2.addActionListener(this) ;
		jm5.add(jm5_1) ;
		jm5.add(jm5_2) ;
		
		jmBar.add(jm1) ;
		jmBar.add(jm2) ;
		jmBar.add(jm3) ;
		jmBar.add(jm4) ;
		jmBar.add(jm5) ;
		return jmBar ;
	}

	@Override
	public void run() {
		
		while(true){
			timeLabel.setText(Tookit.getCurrentTime()) ;
			try {
				Thread.sleep(1000) ;
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}//睡一秒
		}
		
	}
	@Override
	public void mouseClicked(MouseEvent e) {
		
		if(((JLabel)e.getSource()).getText().trim().equals("机 票 查 询")){
			card.show(rightPanel, "tsPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		
		
		if(((JLabel)e.getSource()).getText().trim().equals("改 签 处 理")){
			card.show(rightPanel, "gtqPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(((JLabel)e.getSource()).getText().trim().equals("航 班 动 态")){
			card.show(rightPanel, "pqPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(((JLabel)e.getSource()).getText().trim().equals("退 票 处 理")){
			card.show(rightPanel, "rtPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(((JLabel)e.getSource()).getText().trim().equals("退 出 系 统")){
			//退出系统 
			int num = JOptionPane.showConfirmDialog(this, "是否真的退出系统?") ;
			if(num==JOptionPane.YES_OPTION){
				//退出系统 
				System.exit(0) ;
			}
		}
		if(((JLabel)e.getSource()).getText().trim().equals("销 售 统 计")){
			card.show(rightPanel, "scPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(((JLabel)e.getSource()).getText().trim().equals("后 台 管 理")){
			card.show(rightPanel, "bmPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(((JLabel)e.getSource()).getText().trim().equals("系 统 简 介")){
			card.show(rightPanel, "introduce") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		
		
	}
	@Override
	public void mouseEntered(MouseEvent e) {
		//将label变为可见
		for (int i = 0; i < jLabels.length; i++) {
			if(e.getSource()==jLabels[i]){
				//表示 点击到了哪一个
				jLabels[i].setEnabled(true) ;
				jLabels[i].setCursor(new Cursor(Cursor.HAND_CURSOR)) ;//为什么没有效果
				//jLabels[i].validate() ;
				return ;
			}
		}
		
	}
	@Override
	public void mouseExited(MouseEvent e) {

		for (int i = 0; i < jLabels.length; i++) {
			if(e.getSource()==jLabels[i]){
				//表示 点击到了哪一个
				jLabels[i].setEnabled(false) ;
			//	jLabels[i].setCursor(new Cursor(Cursor.MOVE_CURSOR)) ;
				return ;
			}
		}
	}
	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void actionPerformed(ActionEvent e) {

		//表示 是标签
		if(e.getActionCommand().trim().equals("机票查询")){
			card.show(rightPanel, "tsPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(e.getActionCommand().trim().equals("改签查询")){
			card.show(rightPanel, "gtqPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(e.getActionCommand().trim().equals("航班动态")){
			card.show(rightPanel, "pqPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(e.getActionCommand().trim().equals("退票处理")){
			System.out.println("tuipaio");
			card.show(rightPanel, "rtPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		if(e.getActionCommand().trim().equals("back")){
			
			card.show(rightPanel, "bmPanel") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
		
		if(e.getActionCommand().trim().equals("用户退出")){
			//退出系统 
			int num = JOptionPane.showConfirmDialog(this, "是否真的退出系统?") ;
			if(num==JOptionPane.YES_OPTION){
				//退出系统 
				System.exit(0) ;
			}
		}
		if(e.getActionCommand().trim().equals("帮助")){
			//退出系统 
			HelpDialog helpDialog = new HelpDialog(this) ;
			helpDialog.setTitle("帮助") ;
		}
		if(e.getActionCommand().trim().equals("切换用户")){
			//跳到登录页面
			new LoginView().setVisible(true) ;
			this.dispose() ;
		}
		//跳到用户修改界面
		if (e.getActionCommand().trim().equals("用户信息修改")) {
			Userinformodification userinfor = new Userinformodification(MangerMainView.this,user);
			userinfor.setVisible(true);
			MangerMainView.this.dispose() ;
		}
		
		if(e.getActionCommand().trim().equals("系统简介")){
			card.show(rightPanel, "introduce") ;
			jsp.setDividerSize(10);
			jsp.setDividerLocation(200) ;
		}
//		if(e.getActionCommand().trim().equals("系统简介")){
//			card.show(rightPanel, "introduce") ;
//			jsp.setDividerSize(10);
//			jsp.setDividerLocation(200) ;
//		}
	
	}

}

BackManagerPanel

package com.sjsq.view;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;

import javax.imageio.ImageIO;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;


import com.sjsq.bean.FlightAddr;
import com.sjsq.bean.FlightInfo;
import com.sjsq.bean.Seat;
import com.sjsq.dao.DbHandle;
import com.sjsq.model.CheckInfo;
import com.sjsq.model.DataHandle;
import com.sjsq.model.FlightStateModel;
import com.sjsq.tools.DBHelp;
import com.sjsq.tools.ImagePanel;
import com.sjsq.tools.Tookit;

/**
 * 
 * 后台管理
 *
 */
public class BackManagerPanel extends JPanel implements MouseListener,ActionListener{
	
	private JLabel jl1 ,jl2,jl3,jl4;
	private CardLayout card ;
	private ImagePanel ip;
	private JButton jbReset ,jbConfirm ;//createFlight()
	private JCheckBox boxType1,boxType2,boxType3;
	private JComboBox boxStartAir,boxEndAir,boxCompany ;
	private JTextField txtCancelNum ;
	private JButton jbCancel,jbConfirm2;//cancelFlight()
	private JButton jbConfirm3;//modifyFlight()
	private JComboBox boxModiStartAir ,boxModiEndAir, boxModiCompany ;
	private JCheckBox boxModiType1,boxModiType2,boxModiType3;
	private JLabel jlReturn3,jlReturn,jlUpReturn;//modify     createFlight()
	private JButton jbUpCreate ,jbUpDelete;  //updateState()   ,jbUpDelete,jbUpModify
	private JTextField txtModiType,txtModiStartTime,txtModiEndTime,txtModiNum2,txtModiNum1,txtModiPrice1,txtModiPrice2,txtModiNum3, txtModiPrice3;
	private JComboBox cbModiNum;
	private JTable jTable ;
	private JScrollPane jsp ;
	private FlightStateModel fModel;
	private Vector<Vector<String>> states = null ; 
	//数量
	private JTextField txtNum1,txtNum2,txtNum3,txtNum,txtType,txtStartTime,txtEndTime;
	private JTextField txtPrice1,txtPrice2,txtPrice3;
//	private String num1="",num2="",num3="" ;
//	private String price1=null,price2=null,price3=null ;
	String num1,num2,num3,price1,price2,price3 ;
	Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
	DataHandle dataHandle = null ;
	FlightInfo flightInfo= null;
	public BackManagerPanel(){
		UIManager.put("Label.font", Tookit.getFont1()) ;
		UIManager.put("Button.font", Tookit.getFont1()) ;
		UIManager.put("ComboBox.font", Tookit.getFont1()) ;
		UIManager.put("CheckBox.font", Tookit.getFont1()) ;
		dataHandle = new DataHandle() ;
		card = new CardLayout() ;
		this.init();
	}
	/**
	 * 第一个主面板
	 * @return
	 */
	public JPanel onePanel(){
		JPanel jPanel = new JPanel(new BorderLayout()) ;
		//jPanel.setBackground(Color.red);
		jPanel.setPreferredSize(new Dimension(355, 255)) ;
		JLabel jLabel = new JLabel("飞机订票系统后台管理");
		jLabel.setForeground(Color.yellow) ;
		jLabel.setFont(new Font("微软雅黑", Font.BOLD, 32)) ;
		jPanel.add(jLabel,BorderLayout.NORTH) ;
		
		JPanel center = new JPanel(new GridLayout(4,1,20,60)) ;
		center.setOpaque(false) ;
		//center.setBackground(Color.red) ;
		center.setPreferredSize(new Dimension(315,155)) ;
		jl1= new JLabel("创建航班") ;
		jl1.setFont(Tookit.getFont6()) ;
		jl1.setEnabled(false) ;
		jl1.addMouseListener(this) ;
		center.add(Box.createRigidArea(new Dimension(120, 200))) ;
		center.add(jl1) ;
		jl2 = new JLabel("取消航班") ;
		jl2.setFont(Tookit.getFont6()) ;
		jl2.addMouseListener(this);
		jl2.setEnabled(false);
		center.add(Box.createRigidArea(new Dimension(120, 200))) ;
		center.add(jl2) ;
		jl3 = new JLabel("航班修改") ;
		jl3.setFont(Tookit.getFont6()) ;
		jl3.addMouseListener(this);
		jl3.setEnabled(false) ;
		center.add(Box.createRigidArea(new Dimension(120, 200))) ;
		center.add(jl3) ;
		jl4 = new JLabel("航班动态管理") ;
		jl4.setFont(Tookit.getFont6()) ;
		jl4.addMouseListener(this);
		jl4.setEnabled(false);
		center.add(Box.createRigidArea(new Dimension(120, 200))) ;
		center.add(jl4) ;
		
		center.setOpaque(false) ;
		jPanel.add(center) ;
		jPanel.setOpaque(false) ;
		//创建 一个空面板
		JPanel blank = new JPanel() ;
		blank.setOpaque(false) ;
		blank.setPreferredSize(new Dimension(1000, 254)) ;
		jPanel.add(blank,BorderLayout.SOUTH) ;
		return jPanel ;
	}
	/**
	 * 创建 航班面板 
	 * @return
	 */
	public JPanel createFlight(){
		JPanel totalPanel = new JPanel() ;
		totalPanel.setOpaque(false) ;//设置透明
		
		JPanel jpAll=new JPanel();
		jpAll.setOpaque(false);//设置透明
		jpAll.setLayout(new BorderLayout());
		
		JPanel head=new JPanel();
		JLabel jlHead=new JLabel("创建航班");
		jlHead.setForeground(Color.yellow);
		jlHead.setFont(Tookit.getFont5());
		head.add(jlHead);
		head.setOpaque(false) ;//设置透明
		jpAll.add(head,BorderLayout.NORTH);
		
		JPanel jp = new JPanel(new GridLayout(14, 2, 7, 7)) ;
		jp.setOpaque(false) ;//设置透明
		JLabel jl1 = new JLabel("航班号:") ;
		jl1.setForeground(Color.yellow);
		jl1.setFont(Tookit.getFont4());
		jp.add(jl1) ;
		txtNum = new JTextField() ;
		jp.add(txtNum);
		JLabel jl2 = new JLabel("机型:") ;
		jl2.setForeground(Color.yellow);
		jl2.setFont(Tookit.getFont4());
		jp.add(jl2);
		txtType = new JTextField() ;
		jp.add(txtType);
		JLabel jl3 = new JLabel("出发时间:") ;
		jl3.setForeground(Color.yellow);
		jl3.setFont(Tookit.getFont4());
		jp.add(jl3);
		txtStartTime = new JTextField() ;
		jp.add(txtStartTime);
		JLabel jl4 = new JLabel("到达时间:") ;
		jl4.setForeground(Color.yellow);
		jl4.setFont(Tookit.getFont4());
		jp.add(jl4);
		txtEndTime = new JTextField() ;
		jp.add(txtEndTime);
		Vector<String> allAir = dataHandle.queryAllInfo("select a_air from flight_addr where 1 =?",new String[]{"1"}) ;
		JLabel jl5 = new JLabel("出发机场:") ;
		jl5.setForeground(Color.yellow);
		jl5.setFont(Tookit.getFont4());
		jp.add(jl5);
		boxStartAir = new JComboBox(allAir) ;//数据从数据库得到
		jp.add(boxStartAir);
		JLabel jl6 = new JLabel("到达机场:") ;
		jl6.setForeground(Color.yellow);
		jl6.setFont(Tookit.getFont4());
		jp.add(jl6);
		boxEndAir = new JComboBox(allAir) ;//数据从数据库得到
		jp.add(boxEndAir);
		JLabel jl7 = new JLabel("航空公司:") ;
		jl7.setForeground(Color.yellow);
		jl7.setFont(Tookit.getFont4());
		jp.add(jl7);
		//得到 所有 航空公司 从数据库中
		Vector<String> allCompany = dataHandle.queryAllInfo("select f_company from flight_info where 1=?",new String[]{"1"}) ;
		
		boxCompany = new JComboBox(allCompany) ;
		jp.add(boxCompany);
		JLabel jl8= new JLabel("舱位类型:") ;
		jl8.setForeground(Color.yellow);
		jl8.setFont(Tookit.getFont4());
		jp.add(jl8);
		JPanel jpType = new JPanel() ;
		jpType.setOpaque(false) ;
		jp.add(jpType);
		boxType1= new JCheckBox("头等舱") ;
		boxType1.setForeground(Color.yellow);
		boxType1.setOpaque(false);
		boxType1.setSelected(true) ;
		
		boxType2 = new JCheckBox("商务舱") ;
		boxType2.setForeground(Color.yellow);
	//	boxType2.addItemListener(this) ;
		boxType2.setOpaque(false);
		boxType2.setSelected(true) ;
		
		boxType3 = new JCheckBox("经济舱") ;
		boxType3.setForeground(Color.yellow);
		//boxType3.addItemListener(this) ;
		boxType3.setOpaque(false);
		boxType3.setSelected(true) ;
		
		jpType.add(boxType1) ;
		jpType.add(boxType2) ;
		jpType.add(boxType3) ;
		JLabel jl9 = new JLabel("头等舱数量:") ;
		jl9.setForeground(Color.yellow);
		jl9.setFont(Tookit.getFont4());
		jp.add(jl9);
		 txtNum1= new JTextField() ;
		jp.add(txtNum1);
		JLabel jl10 = new JLabel("头等舱价格:") ;
		jl10.setForeground(Color.yellow);
		jl10.setFont(Tookit.getFont4());
		jp.add(jl10);
		txtPrice1= new JTextField() ;
		jp.add(txtPrice1);
		JLabel jl11 = new JLabel("商务舱数量:") ;
		jl11.setForeground(Color.yellow);
		jl11.setFont(Tookit.getFont4());
		jp.add(jl11);
		 txtNum2 = new JTextField() ;
		jp.add(txtNum2);
		JLabel jl12 = new JLabel("商务舱价格:") ;
		jl12.setForeground(Color.yellow);
		jl12.setFont(Tookit.getFont4());
		jp.add(jl12);
		 txtPrice2 = new JTextField() ;
		jp.add(txtPrice2);
		JLabel jl13 = new JLabel("经济舱数量:") ;
		jl13.setForeground(Color.yellow);
		jl13.setFont(Tookit.getFont4());
		jp.add(jl13);
		 txtNum3 = new JTextField() ;
		jp.add(txtNum3);
		JLabel jl14 = new JLabel("经济舱价格:") ;
		jl14.setForeground(Color.yellow);
		jl14.setFont(Tookit.getFont4());
		jp.add(jl14);
		 txtPrice3 = new JTextField() ;
		jp.add(txtPrice3);
		boxType1.addItemListener(new ItemListener() {
			
			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
				BackManagerPanel.this.jCheckBoxOpera(boxType1, txtNum1, txtPrice1) ;

			}
		});
		boxType2.addItemListener(new ItemListener() {
					
					@Override
					public void itemStateChanged(ItemEvent e) {
						// TODO Auto-generated method stub
						BackManagerPanel.this.jCheckBoxOpera(boxType2, txtNum2, txtPrice2) ;
//						}
					}
				});
		boxType3.addItemListener(new ItemListener() {
			
			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
				BackManagerPanel.this.jCheckBoxOpera(boxType3, txtNum3, txtPrice3) ;

			}
		});
		jp.setPreferredSize(new Dimension(450, 555)) ;
		jl1.setHorizontalAlignment(JLabel.CENTER);
		jl2.setHorizontalAlignment(JLabel.CENTER);
		jl3.setHorizontalAlignment(JLabel.CENTER);
		jl3.setHorizontalAlignment(JLabel.CENTER);
		jl4.setHorizontalAlignment(JLabel.CENTER);
		jl5.setHorizontalAlignment(JLabel.CENTER);
		jl6.setHorizontalAlignment(JLabel.CENTER);
		jl7.setHorizontalAlignment(JLabel.CENTER);
		jl8.setHorizontalAlignment(JLabel.CENTER);
		jl9.setHorizontalAlignment(JLabel.CENTER);
		jl10.setHorizontalAlignment(JLabel.CENTER);
		jl11.setHorizontalAlignment(JLabel.CENTER);
		jl12.setHorizontalAlignment(JLabel.CENTER);
		jl13.setHorizontalAlignment(JLabel.CENTER);
		jl14.setHorizontalAlignment(JLabel.CENTER);
		
		 jbConfirm= new JButton("确    定");
		 jbConfirm.addActionListener(this);
		 jbReset = new JButton("重    置");
		 jbReset.addActionListener(this);
		 jlReturn = new JLabel("返回上级菜单");
		 jlReturn.setFont(Tookit.getFont4());
		 jlReturn.addMouseListener(this);
		
		JPanel jpButtom=new JPanel();
		jpButtom.setOpaque(false) ;
		jpButtom.add(jbConfirm);
		jpButtom.add(jbReset);
		jpButtom.add(jlReturn);
		jpAll.add(jpButtom,BorderLayout.SOUTH);
		
		jpAll.add(jp,BorderLayout.CENTER);
		//jpAll.setOpaque(false) ;
		totalPanel.add(jpAll) ;
		//实现上一级菜单的返回
		jlReturn.addMouseListener(this);
		return totalPanel ;
	}
	
	/**
	 * 取消航班
	 * @return
	 */
	public JPanel cancelFlight(){
		JPanel jpAll2=new JPanel();
		jpAll2.setLayout(null);
		jpAll2.setOpaque(false);
		//jpAll.setBackground(Color.yellow);
		
		//JPanel jpHead=new JPanel();
		JLabel jlHead2=new JLabel("取消航班");
		jlHead2.setBounds(400, 100, 150, 40);
		jlHead2.setForeground(Tookit.getColor());
		jlHead2.setFont(Tookit.getFont5());
		
		jbCancel=new JButton("取    消");
		jbConfirm2=new JButton("确    定");
		
		JLabel lbNum=new JLabel("航班号:");
		lbNum.setForeground(Color.yellow);
		lbNum.setFont(Tookit.getFont4());
		lbNum.setBounds(340, 250, 100, 30);
		txtCancelNum=new JTextField();//cancelFlight()
		txtCancelNum.setBounds(450, 250, 150, 30);
		
		jbConfirm2.setBounds(350, 400, 100, 30);
		jbCancel.setBounds(500, 400, 100,30);
		//jlReturn2.setBounds(600, 400, 100, 30);
		
		//jlReturn2.addMouseListener(this);
		
		jpAll2.add(jlHead2);
		jpAll2.add(lbNum);
		jpAll2.add(txtCancelNum);
		jpAll2.add(jbConfirm2);
		jpAll2.add(jbCancel);
		
		jbConfirm2.addActionListener(this);
		jbCancel.addActionListener(this);
		
		//jpAll2.add(jlReturn2);	
		return jpAll2; 
	}
	
	/**
	 *修改航班
	 */
	public JPanel modifyFlight(){
		JPanel modifyPanel = new JPanel() ;
		modifyPanel.setOpaque(false) ;//设置透明
		JPanel jpAll3=new JPanel();
		jpAll3.setOpaque(false);//设置透明
		jpAll3.setLayout(new BorderLayout());
		
		JPanel headPane=new JPanel();
		JLabel jlHead=new JLabel("修改航班");
		jlHead.setForeground(Color.yellow);
		jlHead.setFont(Tookit.getFont5());
		headPane.add(jlHead);
		//head.setPreferredSize(new Dimension(1000,200));
		headPane.setOpaque(false) ;//设置透明
		jpAll3.add(headPane,BorderLayout.NORTH);
		
		JPanel jPane = new JPanel(new GridLayout(14, 2, 7, 3)) ;
		jPane.setOpaque(false) ;//设置透明
		JLabel lbNum = new JLabel("航班号:") ;
		lbNum.setForeground(Color.yellow);
		lbNum.setFont(Tookit.getFont4());
		jPane.add(lbNum) ;
		Vector<String> allFlightNum=dataHandle.queryStringVector("select f_number from flight_info where 1=?", new String[]{"1"});
		cbModiNum = new JComboBox(allFlightNum);
		cbModiNum.addActionListener(this) ;
		cbModiNum.setActionCommand("fid") ;
		jPane.add(cbModiNum);
		JLabel lbType = new JLabel("机型:") ;
		lbType.setForeground(Color.yellow);
		lbType.setFont(Tookit.getFont4());
		jPane.add(lbType);
		txtModiType = new JTextField() ;
		jPane.add(txtModiType);
		JLabel lbStartTime = new JLabel("出发时间:") ;
		lbStartTime.setForeground(Color.yellow);
		lbStartTime.setFont(Tookit.getFont4());
		jPane.add(lbStartTime);
		txtModiStartTime = new JTextField() ;
		jPane.add(txtModiStartTime);
		JLabel lbEndTime = new JLabel("到达时间:") ;
		lbEndTime.setForeground(Color.yellow);
		lbEndTime.setFont(Tookit.getFont4());
		jPane.add(lbEndTime);
		txtModiEndTime = new JTextField() ;
		jPane.add(txtModiEndTime);
		Vector<String> allAir = dataHandle.queryAllInfo("select a_air from flight_addr where 1=?",new String[]{"1"}) ;
		JLabel lbStartAir = new JLabel("出发机场:") ;
		lbStartAir.setForeground(Color.yellow);
		lbStartAir.setFont(Tookit.getFont4());
		jPane.add(lbStartAir);
		boxModiStartAir= new JComboBox(allAir) ;//数据从数据库得到
		jPane.add(boxModiStartAir);
		JLabel lbEndAir = new JLabel("到达机场:") ;
		lbEndAir.setForeground(Color.yellow);
		lbEndAir.setFont(Tookit.getFont4());
		jPane.add(lbEndAir);
		boxModiEndAir= new JComboBox(allAir) ;//数据从数据库得到
		jPane.add(boxModiEndAir);
		JLabel lbCompany = new JLabel("航空公司:") ;
		lbCompany.setForeground(Color.yellow);
		lbCompany.setFont(Tookit.getFont4());
		jPane.add(lbCompany);
		//得到 所有 航空公司 从数据库中
		Vector<String> allCompany = dataHandle.queryAllInfo("select f_company from flight_info where 1=?",new String[]{"1"}) ;
		boxModiCompany = new JComboBox(allCompany) ;
		jPane.add(boxModiCompany);
		JLabel lbSeatType= new JLabel("舱位类型:") ;
		lbSeatType.setForeground(Color.yellow);
		lbSeatType.setFont(Tookit.getFont4());
		jPane.add(lbSeatType);
		JPanel jpType1 = new JPanel() ;
		jpType1.setOpaque(false) ;
		jPane.add(jpType1);
		boxModiType1= new JCheckBox("头等舱") ;
		boxModiType1.setForeground(Color.yellow);
		boxModiType1.setOpaque(false);
		boxModiType2 = new JCheckBox("商务舱") ;
		boxModiType2.setForeground(Color.yellow);
		boxModiType2.setOpaque(false);
		boxModiType3 = new JCheckBox("经济舱") ;
		boxModiType3.setForeground(Color.yellow);
		boxModiType3.setOpaque(false);
		jpType1.add(boxModiType1) ;
		jpType1.add(boxModiType2) ;
		jpType1.add(boxModiType3) ;
		JLabel lbModiNum1 = new JLabel("头等舱数量:") ;
		lbModiNum1.setForeground(Color.yellow);
		lbModiNum1.setFont(Tookit.getFont4());
		jPane.add(lbModiNum1);
		txtModiNum1 = new JTextField() ;
		jPane.add(txtModiNum1);
		JLabel lbModiPrice1 = new JLabel("头等舱价格:") ;
		lbModiPrice1.setForeground(Color.yellow);
		lbModiPrice1.setFont(Tookit.getFont4());
		jPane.add(lbModiPrice1);
		txtModiPrice1 = new JTextField() ;
		jPane.add(txtModiPrice1);
		JLabel lbModiNum2 = new JLabel("商务舱数量:") ;
		lbModiNum2.setForeground(Color.yellow);
		lbModiNum2.setFont(Tookit.getFont4());
		jPane.add(lbModiNum2);
		txtModiNum2 = new JTextField() ;
		jPane.add(txtModiNum2);
		JLabel lbModiPrice2 = new JLabel("商务舱价格:") ;
		lbModiPrice2.setForeground(Color.yellow);
		lbModiPrice2.setFont(Tookit.getFont4());
		jPane.add(lbModiPrice2);
		txtModiPrice2 = new JTextField() ;
		jPane.add(txtModiPrice2);
		JLabel lbModiNum3 = new JLabel("经济舱数量:") ;
		lbModiNum3.setForeground(Color.yellow);
		lbModiNum3.setFont(Tookit.getFont4());
		jPane.add(lbModiNum3);
		txtModiNum3 = new JTextField() ;
		jPane.add(txtModiNum3);
		JLabel lbModiPrice3 = new JLabel("经济舱价格:") ;
		lbModiPrice3.setForeground(Color.yellow);
		lbModiPrice3.setFont(Tookit.getFont4());
		jPane.add(lbModiPrice3);
		txtModiPrice3 = new JTextField() ;
		jPane.add(txtModiPrice3);
		jPane.setPreferredSize(new Dimension(450, 555)) ;
		
		boxModiType1.addItemListener(new ItemListener() {
			
			@Override
			public void itemStateChanged(ItemEvent e) {
				if(!boxModiType1.isSelected()){
					txtModiNum1.setText("--") ;
					txtModiNum1.setEditable(false) ;
					txtModiPrice1.setText(0+"") ;
					txtModiPrice1.setEditable(false) ;
				}else{
					txtModiNum1.setEditable(true) ;
					txtModiPrice1.setEditable(true) ;
				}
			}
		}) ;

		boxModiType2.addItemListener(new ItemListener() {
			
			@Override
			public void itemStateChanged(ItemEvent e) {
				if(!boxModiType2.isSelected()){
					txtModiNum2.setText("--");
					txtModiNum2.setEditable(false);
					txtModiPrice2.setText(0+"");
					txtModiPrice2.setEditable(false);
				}else{
					txtModiNum2.setEditable(true);
					txtModiPrice2.setEditable(true);
				}
			}
		}) ;

		boxModiType3.addItemListener(new ItemListener() {
			
			@Override
			public void itemStateChanged(ItemEvent e) {
				if(!boxModiType3.isSelected()){
					txtModiNum3.setText("--");
					txtModiNum3.setEditable(false);
					txtModiPrice3.setText(0+"");
					txtModiPrice3.setEditable(false);
				}else{
					txtModiNum3.setEditable(true);
					txtModiPrice3.setEditable(true);
				}
			}
		}) ;
		
		lbNum.setHorizontalAlignment(JLabel.CENTER);
		lbType.setHorizontalAlignment(JLabel.CENTER);
		lbStartTime.setHorizontalAlignment(JLabel.CENTER);
		lbEndTime.setHorizontalAlignment(JLabel.CENTER);
		lbStartAir.setHorizontalAlignment(JLabel.CENTER);
		lbEndAir.setHorizontalAlignment(JLabel.CENTER);
		lbCompany.setHorizontalAlignment(JLabel.CENTER);
		lbSeatType.setHorizontalAlignment(JLabel.CENTER);
		lbModiNum1.setHorizontalAlignment(JLabel.CENTER);
		lbModiPrice1.setHorizontalAlignment(JLabel.CENTER);
		lbModiNum2.setHorizontalAlignment(JLabel.CENTER);
		lbModiPrice2.setHorizontalAlignment(JLabel.CENTER);
		lbModiNum3.setHorizontalAlignment(JLabel.CENTER);
		lbModiPrice3.setHorizontalAlignment(JLabel.CENTER);
		
		cbModiNum.addMouseListener(this);
		jlReturn3=new JLabel("返回上级菜单");
		jlReturn3.setFont(Tookit.getFont4());
		jbConfirm3=new JButton("确定修改");
		jbConfirm3.addActionListener(this);
		
		JPanel jpButtom1=new JPanel();
		jpButtom1.setOpaque(false) ;
		jpButtom1.add(jbConfirm3);
//		jpButtom1.add(jbReset3);
		jpButtom1.add(jlReturn3);
		jpAll3.add(jpButtom1,BorderLayout.SOUTH);
		
		jpAll3.add(jPane,BorderLayout.CENTER);
		//jpAll.setOpaque(false) ;
		modifyPanel.add(jpAll3) ;
		//实现上一级菜单的返回
		jlReturn3.addMouseListener(this);
		return modifyPanel ;
	}
	/**
	 * 修改航班动态
	 * @return
	 */
	public JPanel updateState(){
		
		JPanel jp = new JPanel(new BorderLayout());
		jp.setOpaque(false) ;
		//北边
		JPanel north = new JPanel() ;
		north.setOpaque(false) ;
		north.setPreferredSize(new Dimension(Tookit.getScreen().width,94)) ;
		jp.add(north,BorderLayout.NORTH) ;
		
		//中间
		JPanel center = new JPanel(new BorderLayout());
		center.setOpaque(false) ;
		JLabel jlName = new JLabel("航班动态管理",JLabel.CENTER);
		jlName.setFont(Tookit.getFont5()) ;
		jlName.setForeground(Color.YELLOW) ;
		center.add(jlName,BorderLayout.NORTH) ;
		jsp = new JScrollPane() ;
		
		
		StringBuffer sb=new StringBuffer();
		sb.append("select fi.F_number, fa.a_city,fa1.a_city,s.fs_date,s.fs_state ");
		sb.append("from  flight_info fi,flight_addr  fa, flight_addr  fa1,state s ");
		sb.append("where s.fs_number=fi.f_number  and  fa.a_id= fi.f_start and fa1.a_id=fi.f_end and 1=?");
		final String sql = sb.toString() ;
		new Thread(){
			
			public void run() {
				
				while(true){
					
					states = new DbHandle().getState(sql,new String[]{"1"}) ;
					fModel = new FlightStateModel(states) ;
//					for(Vector<String> v: states){
//						System.out.println(v);
//					}
					jTable = new JTable() ;
					jTable.setModel(fModel) ;//......
					jTable.setRowHeight(60) ;
					jTable.setBackground(new Color(0xA9CAF3)) ;
					//怎样拿到数据放到表格中
					jsp.setViewportView(jTable) ;
					//重绘
//					jsp.validate() ;
//					jsp.repaint() ;
					
					// 航班动态管理时间10秒钟刷新一次
					try {
						Thread.sleep(10000) ;
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					//移除组件
				}
			};
		}.start() ;
		
		//jScrollPane设置透明
		jsp.setOpaque(false) ;
		jsp.getViewport().setOpaque(false) ;
		center.add(jsp) ;
		jp.add(center,BorderLayout.CENTER) ;
		
		//
		JPanel jpBottom = new JPanel() ;
		jpBottom.setOpaque(false) ;
		jbUpCreate= new JButton("创建航班动态");
		jbUpCreate.addActionListener(this) ;
		jbUpCreate.setFont(Tookit.getFont1()) ;
		jbUpCreate.setBackground(new Color(0xA9CAF3)) ;
		jbUpDelete = new JButton("删除航班动态") ;
		jbUpDelete.addActionListener(this) ;
		jbUpDelete.setBackground(new Color(0xA9CAF3)) ;
		jbUpDelete.setFont(Tookit.getFont1()) ;
//		jbUpModify=new JButton("修改动态");
//		jbUpModify.addActionListener(this);
//		jbUpModify.setFont(Tookit.getFont1());
//		jbUpModify.setBackground(new Color(0xA9CAF3));
		jlUpReturn=new JLabel("返回上级菜单");
		jlUpReturn.setFont(Tookit.getFont4());
		jlUpReturn.addMouseListener(this);
		jpBottom.add(jbUpCreate) ;
		jpBottom.add(jbUpDelete) ;
//		jpBottom.add(jbUpModify) ;
		jpBottom.add(jlUpReturn);
		jp.add(jpBottom,BorderLayout.SOUTH) ;
		
		return jp ;
	
		}

	private void init() {
		
		try {
			ip = new ImagePanel(ImageIO.read(new File("image/171go.jpg")), dimension) ;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		ip.setLayout(card) ;
		ip.add(this.onePanel(),"one") ;
		//创建一个创建航班面板。加入到ip里
		ip.add(this.createFlight(),"create") ;
		//创建一个取消航班面板。。。。。。
		ip.add(this.cancelFlight(),"cancel");
		//创建一个修改航班面板
		ip.add(this.modifyFlight(),"modify");
		//创建一个修改航班动态面板
		ip.add(this.updateState(),"update") ;
		
		ip.setSize(1008,680) ;
		ip.setBackground(new Color(0x498DF8)) ;
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		
		if(e.getSource() instanceof JLabel){
			//鼠标点击
			if(((JLabel)e.getSource())==jl1){
				//创建航班
				card.show(ip, "create") ;
			}
			if((JLabel)e.getSource()==jl2){
				card.show(ip, "cancel");
			}
			if((JLabel)e.getSource()==jl3){
				card.show(ip, "modify");
			}
			if((JLabel)e.getSource()==jl4){
				card.show(ip, "update");
			}
			//createFlight()
			if((JLabel)e.getSource()==jlReturn){
				card.show(ip, "one");
			}
			//modifyFlight()
			if((JLabel)e.getSource()==jlReturn3){
				card.show(ip, "one");
			}
			if((JLabel)e.getSource()==jlUpReturn){
				card.show(ip, "one");
			}
		}
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// 鼠标进入
		if(e.getSource() instanceof JLabel){
			if(((JLabel)e.getSource())==jl1){
				jl1.setForeground(Tookit.getColor()) ;
				jl1.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
				jl1.setEnabled(true);
			}
			if(((JLabel)e.getSource())==jl2){
				jl2.setForeground(Tookit.getColor()) ;
				jl2.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
				jl2.setEnabled(true);
			}
			if(((JLabel)e.getSource())==jl3){
				jl3.setForeground(Tookit.getColor()) ;
				jl3.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
				jl3.setEnabled(true);
			}
			if(((JLabel)e.getSource())==jl4){
				jl4.setForeground(Tookit.getColor()) ;
				jl4.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
				jl4.setEnabled(true);
			}
			//createFlight()里的返回上一级菜单的   标签
			if(((JLabel)e.getSource())==jlReturn){
				jlReturn.setForeground(Tookit.getColor()) ;
				jlReturn.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
				jlReturn.setEnabled(true);
			}
			//modifyFlight()里的返回上一级菜单的   标签
			if(((JLabel)e.getSource())==jlReturn3){
				jlReturn3.setForeground(Tookit.getColor()) ;
				jlReturn3.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
				jlReturn3.setEnabled(true);
			}
			//updateState()里的返回上一级菜单的   标签
			if(((JLabel)e.getSource())==jlUpReturn){
				jlUpReturn.setForeground(Tookit.getColor()) ;
				jlUpReturn.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
				jlUpReturn.setEnabled(true);
			}
		}
	}

	@Override
	public void mouseExited(MouseEvent e) {
		
		if(e.getSource() instanceof JLabel){
			if(((JLabel)e.getSource())==jl1){
				jl1.setEnabled(false);
			}
			if(((JLabel)e.getSource())==jl2){
				jl2.setEnabled(false);
			}
			if(((JLabel)e.getSource())==jl3){
				jl3.setEnabled(false);
			}
			if(((JLabel)e.getSource())==jl4){
				jl4.setEnabled(false);
			}
			//createFlight()里的'返回上一级'菜单的标签
			if(((JLabel)e.getSource())==jlReturn){
				jlReturn.setEnabled(false);
			}
			//modifyFlight()里的'返回上一级'菜单的标签
			if(((JLabel)e.getSource())==jlReturn3){
				jlReturn3.setEnabled(false);
			}
			//updateState()里的'返回上一级'菜单的标签
			if(((JLabel)e.getSource())==jlUpReturn){
				jlUpReturn.setEnabled(false);
			}
		}
		
		// 修改航班:输入航班号时触发事件
//		if(e.getSource() instanceof JTextField){
//			String fNumber=txtModiNum.getText().trim();
//			String fType=null;
//			String fStartTime=null;
//			String fEndTime=null;
//			FlightAddr fStart=null;
//			FlightAddr fEnd=null;
//			String fCompany=null;
//			//flightInfo=new FlightInfo();
//			//获得航班号
//			StringBuffer sql=new StringBuffer();
//			sql.append("select ");
//			sql.append("* ");
//			sql.append("from flight_info ");
//			sql.append("where f_number=?");
//			FlightInfo flightInfo=new FlightInfo(String fNumber, String fType, String fStartTime,
//					String fEndTime, FlightAddr fStart, FlightAddr fEnd, String fCompany);
//            flightInfo=dataHandle.queryFlightInfo(sql.toString(), new String[]{"sFlightNum"});
//            txtModiNum.setEditable(false);
//            System.out.println("the info is:"+flightInfo);//null
//            txtModiType.setText(flightInfor.get(1));
//			txtModiStartTime.setText(flightInfor.get(2));
//			txtModiEndTime.setText(flightInfor.get(3));
//            for(String s:flightInfor){
//            	System.out.println(s);
//            }
//			
//		}
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public ImagePanel getIp() {
		return ip;
	}
	/**
	 * JCheckBox的操作
	 * @param jCheckBox
	 * @param txtNum
	 * @param txtPrice
	 */
	public void jCheckBoxOpera(JCheckBox jCheckBox,JTextField txtNum ,JTextField txtPrice){
		if(!jCheckBox.isSelected()){
			//头等舱数量 
			txtNum.setEditable(false) ;
			txtPrice.setEditable(false) ;
		}
		if(jCheckBox.isSelected()){
			//头等舱数量 
			txtNum.setEditable(true) ;
			txtPrice.setEditable(true) ;
		}
	}
	public boolean checkSeatInfo(String num,String price){
		
		if(num.matches("\\d+") && price.matches("\\d+|(\\d+\\.\\d\\d)")){
			return true;
		}
		return false ;
	}
	
	public void clear(){
		txtNum.setText("") ;
		txtType.setText("") ;
		txtStartTime.setText("") ;
		txtEndTime.setText("") ;
		boxStartAir.setSelectedIndex(0) ;
		boxEndAir.setSelectedIndex(0) ;
		boxCompany.setSelectedIndex(0) ;
		boxType1.setSelected(true) ;
		boxType2.setSelected(true) ;
		boxType3.setSelected(true) ;
		txtNum1.setText("");
		txtNum2.setText("");
		txtNum3.setText("");
		txtPrice1.setText("") ;
		txtPrice2.setText("") ;
		txtPrice3.setText("") ;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		//createFlight()里的确定创建按钮
		if(e.getSource() == jbConfirm){
			
			//出发机场
			String flightNum = txtNum.getText().trim() ;
			String flightType = txtType.getText().trim() ;
			String startTime = txtStartTime.getText().trim() ;
			String endTime = txtEndTime.getText().trim() ;
			
			int startIndex = boxStartAir.getSelectedIndex() ;
			int endIndex = boxEndAir.getSelectedIndex() ;
			String startAir = (String)boxStartAir.getSelectedItem() ;
			String endAir = (String)boxEndAir.getSelectedItem() ;
			String company = (String)boxCompany.getSelectedItem() ;
			//首先检测 数据 格式 是否正确 
			if(flightNum.equals("")||flightType.equals("")||startTime.equals("")||endTime.equals("")||startIndex==0||endIndex==0){
				JOptionPane.showMessageDialog(null, "数据不能为空") ;
				return ;
			}
			//00:00 01  02 .....09
			//10  11.....19
			//20  24
			if(!startTime.matches("([0-1][0-9]|[2][0-4]):[0-5][0-9]")){
				JOptionPane.showMessageDialog(null, "出发时间格式不对") ;
				txtStartTime.setText("") ;
				return ;
			}
			if(!endTime.matches("([0-1][0-9]|[2][0-4]):[0-5][0-9]")){
				JOptionPane.showMessageDialog(null, "到达时间格式不对") ;
				txtEndTime.setText("") ;
				return ;
			}
			//时间输入是不是正确   可以不做 这个判断
//			if(startTime.compareTo(endTime)>=0){
//				JOptionPane.showMessageDialog(null, "出发时间跟到达时间不合理!") ;
//				txtEndTime.setText("") ;
//				txtStartTime.setText("") ;
//				return ;
//			}
			if(startAir.equals(endAir)){
				JOptionPane.showMessageDialog(null, "出发机场不能和到达相同!!") ;
				return ;
			}
			
			//对头等舱处理
			if(boxType1.isSelected()){
				num1 = txtNum1.getText().trim() ;//得到头等舱数量 
				price1 = txtPrice1.getText().trim() ;//得到 头等舱的价格
				//判断格式
				boolean b = BackManagerPanel.this.checkSeatInfo(num1, price1) ;
				if(b==false){
					JOptionPane.showMessageDialog(null, "头等舱数量或价格格式有误") ;
					txtNum1.setText("") ;
					txtPrice1.setText("") ;
					return ;
				}
			}else{
				num1 = "--" ;//没有数量 
				price1 = "0" ;//价钱 为0
				
			}
			//商务等舱处理
			if(boxType2.isSelected()){
				 num2 = txtNum2.getText().trim() ;//得到头等舱数量 
				 price2 = txtPrice2.getText().trim() ;//得到 头等舱的价格
				//判断格式
					boolean b = BackManagerPanel.this.checkSeatInfo(num2, price2) ;
					if(b==false){
						JOptionPane.showMessageDialog(null, "商务舱数量或价格格式有误") ;
						txtNum2.setText("") ;
						txtPrice2.setText("") ;
						return ;
					}
			}else {
				num2 = "--" ;//没有数量 
				price2= "0" ;//价钱 为0
			}
			//经济等舱处理
			if(boxType3.isSelected()){
				 num3 = txtNum3.getText().trim() ;//得到头等舱数量 
				 price3 = txtPrice3.getText().trim() ;//得到 头等舱的价格
				//判断格式
					boolean b = BackManagerPanel.this.checkSeatInfo(num3, price3) ;
					System.out.println(b);
					if(b==false){
						JOptionPane.showMessageDialog(null, "经济舱数量或价格格式有误") ;
						txtNum3.setText("") ;
						txtPrice3.setText("") ;
						return ;
					}
			}else {
				num3 = "--" ;//没有数量 
				price3= "0" ;//价钱 为0
			}
			if (num1.equals("") || num2.equals("") || num3.equals("")
					|| price1.equals("") || price2.equals("")
					|| price3.equals("")) {
					JOptionPane.showMessageDialog(BackManagerPanel.this, "数据不能为空!!!") ;
					return ;
			}
			
			//验证文件框 信息成功
			//验证 这个航班 Id号是不是已经存在
			CheckInfo cInfo = new CheckInfo() ;
			boolean b = cInfo.checkisExist("select * from flight_info where 1=? ", new String[]{"1"}, flightNum) ;
			if(b){
				JOptionPane.showMessageDialog(null, "航班号已经存在!重新输入") ;
				txtNum.setText("") ;
				return ;
			}
		
			//将信息插入到航班表 和 Seat表       ????需要作事物处理    应该自动返回加入一个返回航班 
			String startAirId = dataHandle.queryOneString("select  a_id from flight_addr where a_air=?", new String[]{startAir}) ;
			String endAirId = dataHandle.queryOneString("select  a_id from flight_addr where a_air=?", new String[]{endAir}) ;
			System.out.println(startAir+"   "+endAirId);
			boolean b1  = dataHandle.update("insert into flight_info values(?,?,?,?,?,?,?)", new String[]{flightNum,flightType,startTime,endTime,startAirId,endAirId,company}) ;
			 //航班插入成功
			 boolean b2 = dataHandle.update("insert into seat values(?,?,?,"+Float.parseFloat(price3)+")", new String[]{flightNum,"经济舱",num3}) ;
			 boolean b3 = dataHandle.update("insert into seat values(?,?,?,"+Float.parseFloat(price2)+")", new String[]{flightNum,"商务舱",num2}) ;
			 boolean b4 = dataHandle.update("insert into seat values(?,?,?,"+Float.parseFloat(price1)+")", new String[]{flightNum,"头等舱",num1}) ;
			 if(b1&&b2&&b3&&b4){
				//进入第主页面
				int n = JOptionPane.showConfirmDialog(null, "航班插入成功!是否继续?") ;
				 if(n==JOptionPane.YES_OPTION){
					  card.show(ip, "create") ;
				 }else {
					card.show(ip, "one") ;
				}
				 BackManagerPanel.this.clear() ;
				 //插入成功!!
			 }else {
				JOptionPane.showMessageDialog(null, "航班插入失败") ;
			}	
		}
		
		//createFlight()里的重置按钮
		if(e.getSource()==jbReset){
			clear();
		}
		//点击取消就返回上一级cancelFlight()里 的取消按钮
		if(e.getSource()==jbCancel){
			card.show(ip, "one");
		}
		//点击确认就按照航班号先删除所在的座位数和航班信息表中的该条记录
		if(e.getSource()==jbConfirm2){
			String fNumber=txtCancelNum.getText().trim();
			//判断该航班号是否为空
			if(fNumber.equals("")){
				JOptionPane.showMessageDialog(null, "数据不能为空!");
				return;
			}
			//先判断该航班号是否存在
			Vector<String> fNums = dataHandle.queryStringVector("select f_number from flight_info where 1=? ", new String[]{"1"}) ;
			if(!fNums.contains(fNumber)){
				//表示不存在
				JOptionPane.showMessageDialog(null, fNumber+"航班号不存在!") ;
				txtCancelNum.setText("") ;
				return ;
			}
			Connection conn=null;
			Statement st=null;
			int b1=0,b2=0;
			try {
				
				DBHelp  dbHelp=new DBHelp();
				conn =dbHelp.getConnection();
				st =conn.createStatement();
				conn.setAutoCommit(false);
				String sql="delete from seat where f_number='"+fNumber+"'";
				b1=st.executeUpdate(sql);
				//String[] paras=new String[]{fNumber};	
			
				//DataHandle dataHandle=new DataHandle();
				//boolean b1=dataHandle.update(sql, paras);
			
				sql="delete from flight_info where f_number='"+fNumber+"'";
			
				b2 = st.executeUpdate(sql);
			} catch (SQLException e2) {
				try {
					conn.rollback();
					JOptionPane.showMessageDialog(null, "取消航班失败!");
				} catch (SQLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
			//boolean b2=dataHandle.update(sql, paras);
			System.out.println(b1+" "+b2);
			if(b1>0 && b2>0){
				try {
					conn.commit();
					JOptionPane.showMessageDialog(null, "取消航班成功!");
					txtCancelNum.setText("") ;
					card.show(ip, "one") ;
				} catch (SQLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
			}else{
				try {
					conn.rollback();
					JOptionPane.showMessageDialog(null, "取消航班失败!");
				} catch (SQLException e1) {
					JOptionPane.showMessageDialog(null, "取消航班失败!");
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			
			}
			
		}
		//点击  航班号  时所触发的事件,将该航班的所有信息赋值
		if(e.getActionCommand().equals("fid")){
			JOptionPane.showMessageDialog(null, cbModiNum.getSelectedItem()) ;
			//航班id号
			String selectFlightId = (String)cbModiNum.getSelectedItem() ;
			//根据Id查到 起始机场
			String startAirplane = dataHandle.queryOneString("select f_start from flight_info where f_number=?", new String[]{selectFlightId}) ; 
			String endAirplane = dataHandle.queryOneString("select f_end from flight_info where f_number=?", new String[]{selectFlightId}) ; 
			System.out.println("起始机场:"+startAirplane+"    end:"+endAirplane);
			
			//先得到  FlightAddr ----------->>>>?????????
			FlightAddr startAddr=dataHandle.queryOneFlightAddr("select * from flight_addr where a_id=?", new String[]{startAirplane});
			System.out.println("FlightAddr:"+startAddr);
			String startCity=startAddr.getA_city();
			FlightAddr endAddr=dataHandle.queryOneFlightAddr("select * from flight_addr where a_id=?", new String[]{endAirplane});
			String endCity=endAddr.getA_city();
			System.out.println("起始城市:"+startCity+"    end:"+endCity);
			
			//通过起始地址和目的地得到FlightInfo 
			String sql="select * from flight_info where f_number=?";
			FlightInfo fInfo=dataHandle.queryFlightById(sql, new String[]{selectFlightId}, startAddr, endAddr);
			if(fInfo==null){
				JOptionPane.showMessageDialog(null, "数据为空!");
				return ;
			}
			txtModiType.setText(fInfo.getF_type());
			txtModiStartTime.setText(fInfo.getF_start_time());
			txtModiEndTime.setText(fInfo.getF_end_time());
			boxModiStartAir.setSelectedItem(fInfo.getF_start().getA_air());
//			boxModiStartAir.setEditable(false);
			boxModiEndAir.setSelectedItem(fInfo.getF_end().getA_air());
//			boxModiEndAir.setEditable(false);
			boxModiCompany.setSelectedItem(fInfo.getF_company());
			//Seat
			sql="select * from seat where f_number=?";
			Vector<Seat> selectSeat=dataHandle.querySeatById(sql, new String[]{selectFlightId}, fInfo, startAddr);
			System.out.println("---座位信息----"+selectSeat.get(0)+"   "+selectSeat.get(1)+selectSeat.get(2));
			for(Seat s:selectSeat){
				if(s.getS_type().equals("头等舱")){		
					if(s.getS_number().matches("\\d+")){
						boxModiType1.setSelected(true);
					}
					txtModiNum1.setText(s.getS_number());
					txtModiPrice1.setText(s.getS_price()+"");
				}
				if(s.getS_type().equals("商务舱")){
					if(s.getS_number().matches("\\d+")){
						boxModiType2.setSelected(true);
					}
					txtModiNum2.setText(s.getS_number());
					txtModiPrice2.setText(s.getS_price()+"");
				}
				if(s.getS_type().equals("经济舱")){
					if(s.getS_number().matches("\\d+")){
						boxModiType3.setSelected(true);
					}
					txtModiNum3.setText(s.getS_number());
					txtModiPrice3.setText(s.getS_price()+"");
				}
			}
		}
		//点击确认修改的按钮
		if(e.getSource()==jbConfirm3){
			String flightId = (String)cbModiNum.getSelectedItem() ;//航班ID
			String fType=txtModiType.getText();
			String fStartTime=txtModiStartTime.getText();
			String fEndTime=txtModiEndTime.getText();
			String startAirString = (String)boxModiStartAir.getSelectedItem() ;
			String endAirString = (String) boxModiEndAir.getSelectedItem() ;
			String fComp=String.valueOf(boxModiCompany.getSelectedItem());
			String fNum1=txtModiNum1.getText();
			String fPrice1=txtModiPrice1.getText();
			String fNum2=txtModiNum2.getText();
			String fPrice2=txtModiPrice2.getText();
			String fNum3=txtModiNum3.getText();
			String fPrice3=txtModiPrice3.getText();
			
			//先得到  FlightAddr ----------->>>>?????????
			FlightAddr startAddr=dataHandle.queryOneFlightAddr("select * from flight_addr where a_air=?", new String[]{startAirString});
			System.out.println("FlightAddr:"+startAddr);
			FlightAddr endAddr=dataHandle.queryOneFlightAddr("select * from flight_addr where a_air=?", new String[]{endAirString});
			if(startAddr==null&&endAddr==null){
				JOptionPane.showMessageDialog(null, "目的地或出发地不存在!!");
				return ;
			}
			//要修改两张表1.flightInfo 
			String sql="update flight_info set f_Type=?,f_start_time=?,f_end_time=?,f_company=?,f_start=?,f_end=? where f_number=?";
			
			boolean bInfo=dataHandle.update(sql, new String[]{fType,fStartTime,fEndTime,fComp,startAddr.getA_id(),endAddr.getA_id(),flightId});
			
			//2.Seat  修改航班舱位表?
			sql="update seat set s_number=?,s_price=? where f_number=? and s_type=?";
			boolean bSeat1=dataHandle.update(sql, new String[]{fNum1,fPrice1,flightId,"头等舱"});
			sql="update seat set s_number=?,s_price=? where f_number=? and s_type=?";
			boolean bSeat2=dataHandle.update(sql, new String[]{fNum2,fPrice2,flightId,"商务舱"});
			sql="update seat set s_number=?,s_price=? where f_number=? and s_type=?";
			boolean bSeat3=dataHandle.update(sql, new String[]{fNum3,fPrice3,flightId,"经济舱"});
			System.out.println("boolean:"+bInfo+"  "+bSeat1+"  "+bSeat2+"  "+bSeat3);
			if(bInfo && bSeat1 && bSeat2 && bSeat3){
				int n = JOptionPane.showConfirmDialog(null, "修改成功!数据已录入数据中,是否继续修改?");
				if(n==JOptionPane.NO_OPTION){
					card.show(ip,"one");
				}
			}else{
				JOptionPane.showMessageDialog(null, "修改失败!");
			}
		}
		//点击航班动态管理的创建按钮
		if(e.getSource()==jbUpCreate){
			StateAddDialog sad = new StateAddDialog();
			sad.setVisible(true);
		}
		if(e.getSource()==jbUpDelete){
			
			
			System.out.println("111");
			
			
			//删除航班
			int selectRow = jTable.getSelectedRow() ;
			//得到 航班Id号跟动态日期
			String selectId = (String)jTable.getValueAt(selectRow, 0) ;
			String selectStateDate = (String)jTable.getValueAt(selectRow, 3) ;
			System.out.println("selectId:"+selectId);
			System.out.println("selectStateDate:"+selectStateDate);
			int num = JOptionPane.showConfirmDialog(null, "确认删除?") ;
			
			if(num==JOptionPane.YES_OPTION){
				boolean b = dataHandle.update("delete from state where fs_number=? and fs_date=?", new String[]{selectId,selectStateDate}) ;
				if(b){
					JOptionPane.showMessageDialog(null, selectId+"  "+selectStateDate+"动态已删除") ;
				}else {
					JOptionPane.showMessageDialog(null, "未知错误!删掉失败!") ;
				}
			}
			
		}
	}
//	@Override
//	public void itemStateChanged(ItemEvent e) {
//		
//		if(e.getSource() instanceof JCheckBox){
//			
//			JCheckBox jcb = ((JCheckBox)e.getSource());
//			if(jcb.)
//		}
//	}
	
	
}

四、其他事宜

1.更多系统

Java+Swing系统系列实现

Java+Swing实现斗地主游戏

Java+Swing实现图书管理系统

Java+Swing实现医院管理系统

Java+Swing实现考试管理系统

Java+Swing实现酒店管理系统

Java+Swing实现超市管理系统

Java+Swing实现电影购票系统

Java+Swing实现仓库管理系统-1

Java+Swing实现仓库管理系统-2

Java+Swing实现进销存管理系统

Java+Swing实现自助取款机系统

Java+Swing实现通讯录管理系统

Java+Swing实现停车场管理系统

Java+Swing实现学生信息管理系统-1

Java+Swing实现学生信息管理系统-2

Java+Swing实现学生宿舍管理系统

Java+Swing实现学生选课管理系统

Java+Swing实现学生成绩管理系统

Java+Swing实现学校教材管理系统

Java+Swing实现学校教务管理系统

Java+Swing实现企业人事管理系统

Java+Swing实现电子相册管理系统

Java+Swing实现超市管理系统-TXT存储数据

Java+Swing实现自助取款机系统-TXT存储数据

Java+Swing实现宠物商店管理系统-TXT存储数据

Java+JSP系统系列实现

Java+JSP实现学生图书管理系统

Java+JSP实现学生信息管理系统

Java+JSP实现用户信息管理系统

Java+JSP实现教师信息管理系统

Java+JSP实现学生宿舍管理系统

Java+JSP实现商品信息管理系统

Java+JSP实现宠物信息管理系统

Java+JSP实现学生成绩管理系统

Java+Servlet系统系列实现

Java+Servlet+JSP实现航空订票系统

Java+Servlet+JSP实现新闻发布系统

Java+Servlet+JSP学生宿舍管理系统

Java+Servlet+JSP实现图书管理系统

Java+Servlet+JSP实现停车场管理系统

Java+Servlet+JSP实现房屋租赁管理系统

Java+Servlet+JSP实现学生信息管理系统

Java+Servlet+JSP实现学生选课管理系统

Java+Servlet+JSPl实现学生选课签到系统

Java+Servlet+JSP实现宠物诊所管理系统

Java+Servlet+JSP实现学生成绩管理系统-1

Java+Servlet+JSP实现学生成绩管理系统-2

Java+SSM系统系列实现

Java+SSM+JSP实现网上考试系统

Java+SSM+JSP实现宠物商城系统

Java+SSM+JSP实现超市管理系统

Java+SSM+JSP实现学生成绩管理系统

Java+SSM+JSP实现学生信息管理系统

Java+SSM+JSP实现药品信息管理系统

Java+SSM+JSP实现汽车信息管理系统

Java+SSM+Jspl实现商品信息管理系统

Java+SSM+JSP+Maven实现网上书城系统

Java+SSM+JSP+Maven实现学校教务管理系统

Java+SSH系统系列实现

Java+SSH+JSP实现在线考试系统

Java+SSH+JSP实现医院在线挂号系统

Java+Springboot系统系列实现

Java+Springboot+H-ui+Maven实现营销管理系统

Java+Springboot+Bootstrap+Maven实现网上商城系统

Java+Springboot+Bootstrap+Maven实现景区旅游管理系统

1.更多JavaWeb系统请关注专栏。

https://blog.csdn.net/helongqiang/category_10020130.html

2.更多JavaSwing系统请关注专栏。

https://blog.csdn.net/helongqiang/category_6229101.html

2.源码下载

私信我或者主页联系我。

3.运行项目

关注B站:水坚石青

后期有更多干货视频推出!!!

Eclipse如何导入JavaSwing项目超详细教程

4.权益备注

如有侵权请联系我删除。

5.支持博主

如果您觉得此文对您有帮助,请点赞加关注加收藏。祝您生活愉快!

  • 31
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

水坚石青

你的鼓励是我更新的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值