航空公司管理 java_第1頁(yè)
航空公司管理 java_第2頁(yè)
航空公司管理 java_第3頁(yè)
航空公司管理 java_第4頁(yè)
航空公司管理 java_第5頁(yè)
已閱讀5頁(yè),還剩14頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、import java.awt.Button;import java.awt.Font;import java.awt.Frame;import java.awt.Label;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;public class Denglu extends Frame implements ActionListener(Label pt;Bu

2、tton btn1;Button btn2;Zhuce Zhuce;GLY gly;Denglu()(init();public void init()(setLayout(null);pt=new Label(機(jī)票預(yù)訂系統(tǒng)”);pt.setFont(new Font(宋體,Font.PLAIN,22);pt.setBounds(200,100,200,40);btn1=new Button(旅客”);btn1.setFont(new Font(宋體,Font.PLAIN,18);btn1.setBounds(150, 200, 80, 30);btn2=new Button(管理員);btn

3、2.setFont(new Font(宋體,Font.PLAIN,18);btn2.setBounds(300, 200, 100, 30);add(pt);add(btn1);add(btn2);setTitle(機(jī)票預(yù)訂界面”);setSize(600,500);setVisible(true);btn1.addActionListener(this);btn2.addActionListener(this);this.addWindowListener(new WindowAdapter()(public void windowClosing(WindowEvent e)( System

4、.exit(0););Overridepublic void actionPerformed(ActionEvent e) (if(e.getSource()=btn1)this.setVisible(false);Zhuce = new Zhuce();Zhuce.setVisible(true);elsethis.setVisible(false);gly = new GLY();gly.setVisible(true);/ TODO Auto-generated method stub旅客登陸:import java.awt.Button;import java.awt.Font;imp

5、ort java.awt.Frame;import java.awt.Label;import java.awt.TextField;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JButton;import javax.swing.JOptionPane;public class Zhuce extends sqltext

6、 implements ActionListenerpublic static String name,ID;Zhuce zhuce;Label pt1;Label pt2;Label pt3;Label pt4;TextField tfl;TextField tf2;TextField tf3;TextField tf4;Button btnl;Button btn2;Zhuce()(setLayout(null);pt1=new Label(姓名);pt1.setFont(new Font(宋體,Font.PLAIN,22);pt1.setBounds(150, 100, 80, 30);

7、pt2=new Label(性別);pt2.setFont(new Font(宋體,Font.PLAIN,22);pt2.setBounds(150, 150, 80, 30);pt3=new Label(身份證號(hào)”);pt3.setFont(new Font(宋體,Font.PLAIN,22);pt3.setBounds(120, 200, 100, 30);pt4=new Label(X 作地點(diǎn)”);pt4.setFont(new Font(宋體,Font.PLAIN,22);pt4.setBounds(120, 250, 100, 30);tf1=new TextField(15);tf

8、1.setFont(new Font(宋體,F(xiàn)ont.BOLD, 22);tf1.setBounds(250, 100, 130, 30);tf2=new TextField(15);tf2.setFont(new Font(宋體,Font.BOLD, 22);tf2.setBounds(250, 150, 130, 30);tf3=new TextField(15);tf3.setFont(new Font(宋體,F(xiàn)ont.BOLD, 22);tf3.setBounds(250, 200, 130, 30);tf4=new TextField(15);tf4.setFont(new Font

9、(宋體,Font.BOLD, 22);tf4.setBounds(250, 250, 130, 30);btn1=new Button(進(jìn)入);btn1.setFont(new Font(宋體,Font.PLAIN,18);btn1.setBounds(90, 300, 80, 30);btn2=new Button(返回);btn2.setFont(new Font(宋體,Font.PLAIN,18);btn2.setBounds(340, 300, 80, 30);add(pt1);add(tf1);add(pt2);add(tf2);add(pt3);add(tf3);add(pt4);

10、add(tf4);add(btnl);add(btn2);setTitle(”輸入信息);setSize(600,500);setVisible(true);btn1.addActionListener(this);btn2.addActionListener(this);this.addWindowListener(new WindowAdapter()(public void windowClosing(WindowEvent e)( System.exit(0);/btn2.addActionListener(new ActionListener() (/public void acti

11、onPerformed(ActionEvent e) (/dispose(); /釋放當(dāng)前界面,跳轉(zhuǎn)到下一界面/new Denglu();/);Overridepublic void actionPerformed(ActionEvent e) (/ TODO Auto-generated method stubif(e.getSource()= btn2 )(dispose();new Denglu();setVisible(false);else if(e.getSource() = btn1)(name = tf1.getText();String sex = tf2.getText()

12、;ID = tf3.getText();if(name.equals(”)llsex.equals(”)IIID.equals(”)JOptionPane.showMessageDialog(null,”數(shù)據(jù)不能為空!”,”友情提示,JOptionPane.WARNING_MESSAGE);elsetry userUpdate(name, sex, ID);將數(shù)據(jù)輸入數(shù)據(jù)庫(kù) catch (InstantiationException el) ( / TODO Auto-generated catch block e1.printStackTrace(); catch (IllegalAcces

13、sException e1) ( / TODO Auto-generated catch block e1.printStackTrace();YD yd= new YD(); dispose();setVisible(false);預(yù)定界面:import java.awt.Button;import java.awt.Font;import java.awt.Frame;import java.awt.Label;import java.awt.TextField;import java.awt.event.ActionEvent;import java.awt.event.ActionLi

14、stener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.sql.ResultSet;import javax.swing.JButton;import javax.swing.JOptionPane;public class YD extends sqltext implements ActionListener( public static String starting,distination,planenumber;YD yd;Zhuce zc;Label pt1;L

15、abel pt2;Label pt3;TextField tfl;TextField tf2;TextField tf3;Button btnl;Button btn2;YD()(setLayout(null);pt1=new Label(出發(fā)地”);pt1.setFont(new Font(宋體,Font.PLAIN,22);pt1.setBounds(150, 100, 100, 30);pt2=new Label(目的地”);pt2.setFont(new Font(宋體,Font.PLAIN,22);pt2.setBounds(150, 150, 100, 30);pt3=new La

16、bel(航班編號(hào));pt3.setFont(new Font(宋體,Font.PLAIN,22);pt3.setBounds(130, 200, 120, 30);tf1=new TextField(15);tf1.setFont(new Font(宋體,Font.BOLD, 22);tf1.setBounds(250, 100, 130, 30);tf2=new TextField(15);tf2.setFont(new Font(宋體,Font.BOLD, 22);tf2.setBounds(250, 150, 130, 30);tf3=new TextField(15);tf3.setF

17、ont(new Font(宋體,Font.BOLD, 22);tf3.setBounds(250, 200, 130, 30);btn1=new Button(確定);btn1.setFont(new Font(宋體,Font.PLAIN,18);btn1.setBounds(100, 250, 80, 30);btn2=new Button(返回);btn2.setFont(new Font(宋體,Font.PLAIN,18);btn2.setBounds(340, 250, 80, 30);add(pt1);add(pt2);add(pt3);add(tf1);add(tf2);add(t

18、f3);add(btn1);add(btn2);setTitleC機(jī)票預(yù)訂”);setSize(600,500);setVisible(true);btn1.addActionListener(this);btn2.addActionListener(this);this.addWindowListener(new WindowAdapter()( public void windowClosing(WindowEvent e)( System.exit(0););Overridepublic void actionPerformed(ActionEvent e) ( Button butto

19、n = (Button) e.getSource();if(button = btn2 )(new Zhuce();dispose();setVisible(false);else(starting = tf1.getText().trim();distination = tf2.getText().trim();planenumber = tf3.getText().trim();/System.out.print(true);ResultSet rs;try rs = connect(SELECT starting,destination,planenumber FROM SDP); /S

20、ystem.out.print(true);boolean flag=false;while(rs.next()if(starting.equals(rs.getString(starting)&distination.equals(rs.getString(destination)&planenumber.equals(rs.getString(planenumber) flag=true;System.out.print(true);System.out.print(rs.getRow();QR QR = new QR(yd);QR.QRinit();dispose();setVisibl

21、e(false );break;System.out.print(rs.getRow();if(flag=false)(JOptionPane.showMessageDialog(null, 該航班不存在 JOptionPane.WARNING_MESSAGE);catch (Exception e1) (/ TODO: handle exceptione1.printStackTrace();/ TODO Auto-generated method stub確認(rèn)信息:import java.awt.Button;import java.awt.Font;import java.awt.Lab

22、el;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.sql.ResultSet;import java.util.jar.Attributes.Name;import javax.swing.JButton;import javax.swing.JLabel;import javax.swing.JOptionPane;import ja

23、vax.xml.transform.Source;import org.omg.CORBA.PUBLIC_MEMBER;public class QR extends sqltext implements ActionListener(YD yd;Zhuce zhuce;Label pt1,pt2,pt3,pt4,pt5,pt6,pt7,pt8,pt9,pt10;Button btn1,btn2;public QR(YD yd)(this.yd = yd;/ System.out.print(a);public QR(Zhuce Zhuce)(this.zhuce = Zhuce;/ Syst

24、em.out.print(aaaa);public void QRinit()( setLayout(null);btn1 =new Button(打印機(jī)票”);btn1.setFont(new Font(宋體,Font.PLAIN,18);btn1.setBounds(150, 350, 120, 30);btn2 = new Button(返回);btn2.setBounds(350, 350, 60, 30);btn2.setFont(new Font(宋體,Font.PLAIN,18);pt1 = new Label(姓名:,pt1.setFont(new Font(宋體,Font.P

25、LAIN,22);pt1.setBounds(120, 100, 80, 30);pt2 = new Label(身份證號(hào):,pt2.setFont(new Font(宋體,Font.PLAIN,22);pt2.setBounds(100, 150, 100, 30);pt3 = new Label(始發(fā)地:,pt3.setFont(new Font(宋體,Font.PLAIN,22);pt3.setBounds(100, 200, 100, 30);pt4 = new Label(目的地:,pt4.setFont(new Font(宋體,Font.PLAIN,22);pt4.setBound

26、s(100, 250, 100, 30);pt5 = new Label(航班號(hào):);pt5.setFont(new Font(宋體,Font.PLAIN,22);pt5.setBounds(100, 300, 100, 30);pt6 = new Label();pt6.setFont(new Font(宋體,Font.PLAIN,22);pt6.setBounds(195, 100, 150, 30);pt7 = new Label();pt7.setFont(new Font(宋體,Font.PLAIN,22);pt7.setBounds(215, 150, 150, 30);pt8 =

27、 new Label();pt8.setFont(new Font(宋體,Font.PLAIN,22);pt8.setBounds(200, 200, 150, 30);pt9 = new Label();pt9.setFont(new Font(宋體,Font.PLAIN,22);pt9.setBounds(200, 250, 150, 30);pt10 = new Label();pt10.setFont(new Font(宋體,Font.PLAIN,22);pt10.setBounds(200, 300, 150, 30);btn1.addActionListener(this);btn

28、2.addActionListener(this);System.out.print(Z+Zhuce.ID);pt6.setText(Z);pt7.setText(Zhuce.ID);ResultSet rs;try rs = connect(SELECT starting,destination,planenumber FROM SDP);while(rs.next()if(YD.starting.equals(rs.getString(starting)&YD.distination.equals(rs.getString(destination)&YD

29、.planenumber.equals(rs.getString(planenumber)pt8.setText(rs.getString(destination);pt9.setText(rs.getString(starting);pt10.setText(rs.getString(planenumber); catch (Exception e) e.printStackTrace();add(pt1);add(pt2);add(pt3);add(pt4);add(pt5);add(pt6);add(pt7);add(pt8);add(pt9);add(pt10);add(btn1 );

30、add(btn2);setSize(600, 500);setResizable(false);setLocationRelativeTo(null);setVisible(true);this.addWindowListener(new WindowAdapter() ( / 添加標(biāo)題窗口關(guān)閉事件。public void windowClosing(WindowEvent e) (e.getWindow();dispose();System.exit(0););Overridepublic void actionPerformed(ActionEvent e) (/ TODO Auto-ge

31、nerated method stub/JButton button =(JButton ) e.getSource();if(e.getSource()=btn1)JOptionPane.showMessageDialog(null,機(jī)票打印成功”,”友情提示,JOptionPane.WARNING_MESSAGE);else YD yd = new YD();dispose();setVisible(false);管理員登陸:import java.awt.Button;import java.awt.Font;import java.awt.Frame;import java.awt.L

32、abel;import java.awt.TextField;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JOptionPane;public class GLY extends Frame implements ActionListenerLabel ptl;Label pt2;Label pt3;TextField t

33、fl;TextField tf2;Button btnl;Button btn2;GLY()(setLayout(null);pt1=new Label(管理員登陸”);pt1.setFont(new Font(宋體,Font.PLAIN,22);pt1.setBounds(230,100,200,40);pt2=new Label(管理員 ID);pt2.setFont(new Font(宋體,Font.PLAIN,22);pt2.setBounds(150, 150, 100, 30);pt3=new Label(密碼);pt3.setFont(new Font(宋體,Font.PLAIN

34、,22);pt3.setBounds(170, 200, 80, 30);tf1=new TextField(15);tf1.setFont(new Font(宋體,F(xiàn)ont.BOLD, 22);tf1.setBounds(250, 150, 130, 30);tf2=new TextField(15);tf2.setFont(new Font(宋體,F(xiàn)ont.BOLD, 22);tf2.setBounds(250, 200, 130, 30);btn1=new Button(登陸);btn1.setFont(new Font(宋體,Font.PLAIN,18);btn1.setBounds(

35、120, 250, 80, 30);btn2=new Button(返回);btn2.setFont(new Font(宋體,Font.PLAIN,18);btn2.setBounds(340, 250, 80, 30);add(pt1);add(pt2);add(tf1);add(pt3);add(tf2);add(btn1);add(btn2);setTitle(管理員登陸界面,setSize(600,500);setVisible(true);btn1.addActionListener(this);btn2.addActionListener(this);this.addWindowL

36、istener(new WindowAdapter()( public void windowClosing(WindowEvent e)(System.exit(0););Overridepublic void actionPerformed(ActionEvent e) (if(e.getSource() = btn1)(String adminnumber = tf1.getText();String password = tf2.getText();if(adminnumber.equals(admin)&password.equals(123”)GL gl =new GL();dis

37、pose();setVisible(false);elseJOptionPane.showMessageDialog(null,出錯(cuò),友情提JOptionPane.INFORMATION_MESSAGE);elsedispose();new Denglu();/ TODO Auto-generated method stub航班管理:import java.awt.Button;import java.awt.Font;import java.awt.Frame;import java.awt.Label;import java.awt.event.ActionEvent;import jav

38、a.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JButton;import javax.swing.JOptionPane;public class GL extends sqltext implements ActionListener( Label pt;Button btn1;Button btn2;GL()(setLayout(null);pt=new Label(管理查詢(xún)”);pt.setFont(n

39、ew Font(宋體,Font.PLAIN,20);pt.setBounds(250, 100, 100, 40);btn1=new Button(航班查詢(xún)”);btn1.setFont(new Font(宋體,Font.PLAIN,20);btn1.setBounds(250, 200, 100, 30);btn2=new Button(返回);btn2.setFont(new Font(宋體,Font.PLAIN,18);btn2.setBounds(250, 300, 80, 30);add(pt);add(btn1);add(btn2);setTitle(查詢(xún)界面”);setSize(

40、600,500);setVisible(true);btn1.addActionListener(this);btn2.addActionListener(this);this.addWindowListener(new WindowAdapter()(public void windowClosing(WindowEvent e)(System.exit(0););btn2.addActionListener(new ActionListener() (public void actionPerformed(ActionEvent e) ( dispose(); /釋放當(dāng)前界面,跳轉(zhuǎn)到下一界

41、面 new GLY(););Overridepublic void actionPerformed(ActionEvent e) (if(e.getSource() = btn2)(Denglu dl = new Denglu();dispose();setVisible(false);else (CX cx =new CX();dispose();setVisible(false);/ TODO Auto-generated method stub查詢(xún)機(jī)票:import java.awt.Button;import java.awt.Font;import java.awt.Frame;im

42、port java.awt.Label;import java.awt.TextField;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.sql.ResultSet;import javax.swing.JButton;import javax.swing.JOptionPane;public class CX extends sqlte

43、xt implements ActionListener(YD YD;Label ptl;Label pt2;Label pt3;Label pt4;Label pt5;Label pt6;Label pt7;Button btn;public CX(YD yd)( this.YD = YD;CX()(setLayout(null);pt1=new Label(機(jī)票查詢(xún)”);pt1.setFont(new Font(宋體,Font.PLAIN,20);pt1.setBounds(230,50,200,40);pt2=new Label(出發(fā)地);pt2.setFont(new Font(宋體,

44、Font.PLAIN,20);pt2.setBounds(170, 100, 80, 30);pt3=new Label(目的地”);pt3.setFont(new Font(宋體,Font.PLAIN,20);pt3.setBounds(170, 150, 80, 30);pt4=new Label(航班編號(hào));pt4.setFont(new Font(宋體,Font.PLAIN,20);pt4.setBounds(150, 200, 100, 30);pt5=new Label();pt5.setFont(new Font(宋體,Font.BOLD, 22);pt5.setBounds(2

45、50, 100, 130, 30);pt6=new Label();pt6.setFont(new Font(宋體,Font.BOLD, 22);pt6.setBounds(250, 150, 130, 30);pt7=new Label();pt7.setFont(new Font(宋體,Font.BOLD, 22);pt7.setBounds(250, 200, 130, 30);btn=new Button(返回);btn.setFont(new Font(宋體,Font.PLAIN,18);btn.setBounds(230, 250, 80, 30);add(pt1);add(pt2

46、);add(pt3);add(pt4);add(pt5);add(pt6);add(pt7);add(btn);setTitleC機(jī)票查詢(xún)”);setSize(600,500);setVisible(true);btn.addActionListener(this);this.addWindowListener(new WindowAdapter()( public void windowClosing(WindowEvent e)(System.exit(0););if(YD.starting.equals(null)&YD.distination.equals(null)&YD.plane

47、number.equals(null)JOptionPane.showMessageDialog(null, 請(qǐng) 先 預(yù) 定 JOptionPane.WARNING_MESSAGE);ResultSet rs;try rs = connect(SELECT starting,destination,planenumber FROM SDP);boolean flag = false;while(rs.next()if(YD.starting.equals(rs.getString(starting)&YD.distination.equals(rs.getString(destination)

48、&YD.planenumber.equals(rs.getString(planenumber)/*System.out.print(rs.getString(destination)+rs.getString (“starting)+rs.getString(planenumber) );*/flag = true;pt5.setText(rs.getString(destination);pt6.setText(rs.getString(starting);pt7.setText(rs.getString(planenumber);if(flag = false)JOptionPane.s

49、howMessageDialog(null, 請(qǐng) 先 預(yù) 定 JOptionPane.WARNING_MESSAGE); catch (Exception el) e1.printStackTrace();Overridepublic void actionPerformed(ActionEvent e) if(e.getSource() = btn )GL gl = new GL();dispose();setVisible(false);/ TODO Auto-generated method stubTEXT:public class Test (public static void m

50、ain(String args)(Denglu d=new Denglu();/Zhuce z=new Zhuce();/CX c=new CX();/GL g=new GL();/YD yd = new YD();連接數(shù)據(jù)庫(kù):import java.awt.Frame;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JFrame;public class sqltext extends Frame (public ResultSet connect(String query) throws Exception (Connection con;Statement stmt;ResultSet rs;/加載數(shù)據(jù)庫(kù)驅(qū)動(dòng)程序/DriverManager.registerDriver(new

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論