主界面函数;
/*import flight.query.*; import flight.manage.*; import flight.dingpiao.*;
//import flight.tuipiao.TuiPiao; import flight.assist.*; */ mport java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.border.*;
import java.net.URL;
class Interface extends JPanel implements ActionListener //主界面 { //private MyQuery query; static TestDB manager; private TuiPiao tuiPiao;
private Hangkong dingPiao;
private JButton jbManager = new JButton(\管理\ private JButton jbDingPiao = new JButton(\订票\ private JButton jbTuiPiao = new JButton(\退票\ private JButton jbAbout = new JButton(\关于\ public Interface() { this.setLayout(null);
this.add(jbDingPiao); this.add(jbTuiPiao); this.add(jbManager); this.add(jbAbout);
jbDingPiao.setFont(new Font(\ jbTuiPiao.setFont(new Font(\ jbManager.setFont(new Font(\Times\ jbAbout.setFont(new Font(\Times\ jbDingPiao.setBounds(190,280,80,30); jbTuiPiao.setBounds(290,280,80,30);
jbManager.setBounds(390,280,80,30);
19
jbAbout.setBounds(430,350,80,30); jbManager.addActionListener(this); jbDingPiao.addActionListener(this); jbTuiPiao.addActionListener(this); jbAbout.addActionListener(this);
}
public void paintComponent(Graphics g) { ImageIcon imageIcon = new ImageIcon(\ Image image = imageIcon.getImage(); g.drawImage(image,0,0,this);
}
public void actionPerformed(ActionEvent e) { if (e.getSource() == jbManager ) { CheckID check = new CheckID();
}
else if (e.getSource() == jbDingPiao) { dingPiao = new Hangkong();
dingPiao.setSize(430,300); dingPiao.setResizable(false);
dingPiao.setTitle(\国内机票实时速定\
dingPiao.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); dingPiao.setVisible(true);
}
else if (e.getSource() == jbTuiPiao) {
tuiPiao = new TuiPiao();
20
}
tuiPiao.setSize(470,370); tuiPiao.setResizable(false);
tuiPiao.setTitle(\航班退票系统\
tuiPiao.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); tuiPiao.setVisible(true);
else if (e.getSource() == jbAbout) {
String information = \制作人:\ 孙启欢 杨帅\
\版本: \ 0.00\
\时间: \ 2008-6-21\
\地址: \+ \ 华东交通大学软件学院06软件测试3班\
JOptionPane.showMessageDialog(null,information,\\TION_MESSAGE); }
}
关
于
订票系统主要源代码(部分):
//import flight.assist.*; import java.awt.*;
import java.awt.event.*; import javax.swing.*; import java.sql.*; import java.util.*;
import javax.swing.border.*;
public class Hangkong extends JFrame implements ActionListener {
private String[] string=new String[23];
private JComboBox boxyear=new JComboBox();
21
…………….
private JComboBox boxadult=new JComboBox(); private String[] year={\
private String[] adult={\成人 \儿童 \ 学生 \
String[] };
String[]
private
month={\ private
day={\17\
private JTextField jbtflight=new JTextField(10); ……………..);
private JButton jbtbutton=new JButton(\机 票 预 定\private JButton jbtreturn=new JButton(\返回主页面\Color color=new Color(230,230,255); {if(jbrsingle.isSelected())
{
if(sflight==1) {
JOptionPane.showMessageDialog(this,\航班号不能为空!\ \错误信息
\
jbtflight.setText(\ }
else if(sflight==4) { JOptionPane.showMessageDialog(this,\没有此次航班,请您重 } else {
clientFrame.getContentPane().add(client.panel(string)); clientFrame.setTitle(\客户资料\……………….
22
新查阅!\
\jbtflight.setText(\
错误信息
\
} {
}
client.jbtchildticketnumber.setText(\
else if(jbrdouble.isSelected())
isFull=seatinformation.isFull(string[11],string[10]); dflight=doubleflight();
if(sflight==1) { JOptionPane.showMessageDialog(this,\第一航班号不能为
空!\错误信息\
}
一航班号
else if(dflight==5) { JOptionPane.showMessageDialog(this,\返回航班号与第不匹配\\n请重新输入返回航班号!\错误信息 }
else if(jbrmultiple.isSelected()) {
isFull=seatinformation.isFull(string[11],string[10]); mflight=multipleflight(); if(sflight==1) {
JOptionPane.showMessageDialog(this,\第一航班号不能为
23
\
}
}
jbtflight1.setText(\
else { clientFrame.getContentPane().add(client.panel(string)); }
clientFrame.setSize(450,460); clientFrame.setTitle(\客户资料\clientFrame.setVisible(true); this.setVisible(false);