当前位置:首页 > 民航订票系统数据库课程设计论文
JLabel jl1=new JLabel(\航班号 :\ JLabel jl2=new JLabel(\登机时间:\ JLabel jl3=new JLabel(\出发地点: \ JLabel jl4=new JLabel(\目的地点:\
private JTextField jd1=new JTextField(15);
private JTextField jd2=new JTextField(15); private JTextField jd3=new JTextField(15); private JTextField jd4=new JTextField(15); JButton query=new JButton(\查 询 \ JButton outuran=new JButton(\返 回 \ JLabel[] jl={jl1,jl2,jl3,jl4};
private JTextField[] jt={jd1,jd2,jd3,jd4};
Box box1=Box.createVerticalBox(); //创建纵向Box容器
private Box box2=Box.createVerticalBox();
Box box3=Box.createHorizontalBox(); //创建横向Box容器
Connection con; Statement stmt; ResultSet rs;
public QueryFilght(){
this.setTitle(\查询航班信息\this.setBounds(300,200,260,215); this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false);
37
query.addActionListener(this); outuran.addActionListener(this); for(int i=0;i<4;i++) { }
box1.add(query); for(int i=0;i<4;i++) { }
box2.add(outuran);
this.add(box3); //将横向Box容器box3添加到窗体中 box3.add(Box.createRigidArea(new Dimension(20,20)));
box3.add(box1); //将纵向Box容器box1添加到横向Box容器box3中 box3.add(box2); //将纵向Box容器box2添加到横向Box容器box3中 jd1.setText(\请输入需查询的航班号!\
box2.add(jt[i]);
box2.add(Box.createVerticalStrut(16)); box1.add(jl[i]);
box1.add(Box.createVerticalStrut(20));
}
public void actionPerformed(ActionEvent e) {
String getflight=null; //定义该客户航班号 if(e.getSource()==query)
38
{ }
if(e.getSource()==outuran) {
try {
new LoginOfManager(); String t1=jd1.getText(); //jd3.setText(t1); try{
con = JDBCTools.getConnection(\stmt = con.createStatement();
rs = stmt.executeQuery(\while(rs.next()){ } }
catch(Exception e2){}
for(int i=1;i<4;i++){
jt[i].setText(rs.getString(i+1));
}
JDBCTools.releaseDB(rs, stmt, con);
} catch (Exception e1) { }
39
// TODO Auto-generated catch block e1.printStackTrace();
} }
}
}
this.dispose();
public static void main(String[] args){
new QueryFilght();
//订票界面 package Mainview; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; import javax.swing.*; import JDBCtool.JDBCTools;
public class Book extends JFrame implements ActionListener{
int dingdannum=10000000; //设置初始订单号;
40
共分享92篇相关文档