资源描述:
《[计算机软件及应用]火车售票系统完整代码》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、packagecom.yue;importjava.awt.Color;importjava.awt.GridBagConstraints;importjava.awt.GridBagLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.sql.CallableStatement;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLE
2、xception;importjava.sql.Statement;importjavax.swing.BorderFactory;importjavax.swing.JButton;importjavax.swing.JLabel;importjavax.swing.JOptionPane;importjavax.swing.JPanel;importjavax.swing.JPasswordField;importjavax.swing.JTextArea;importjavax.swing.JTextField;publicclassBuyPanelextendsJPanel{Strin
3、gBuffersb=newStringBuffer();privatebooleanflag=false;JTextAreajtArea=newJTextArea(10,78);JLabelbuyLabel=newJLabel("订票");JTextFieldfId=newJTextField(7);JTextFieldftid=newJTextField(7);JTextFieldfche=newJTextField(7);JTextFieldfzhangshu=newJTextField(7);JTextFieldfbodyId=newJTextField(7);JPasswordFiel
4、djpField=newJPasswordField(7);publicJPanelgetBuypn(){JPanelpan=newJPanel();GridBagLayoutlayout=newGridBagLayout();pan.setLayout(layout);GridBagConstraintscon=getGridBagConstraints(0,0,1,1,100,100,GridBagConstraints.NONE,GridBagConstraints.WEST);pan.add(buyLabel,con);con=getGridBagConstraints(0,2,1,1
5、,100,100,GridBagConstraints.NONE,GridBagConstraints.WEST);pan.add(newpan3(),con);con=getGridBagConstraints(0,3,1,1,100,100,GridBagConstraints.NONE,GridBagConstraints.WEST);pan.add(newpan4(),con);con=getGridBagConstraints(0,4,1,1,100,100,GridBagConstraints.NONE,GridBagConstraints.EAST);pan.add(newpan
6、5(),con);this.setLocation(270,150);this.add(pan);returnpan;}/***定义下面购票操作区面板pan3**@authorAdministrator**/classpan3extendsJPanel{JLabellId=newJLabel("车票号码");JLabelltid=newJLabel("车票号码");JLabelche=newJLabel("车次");JLabellbodyId=newJLabel("身份证号");JLabelpassword=newJLabel("密码");JLabellzhangshu=newJLabel("
7、所需张数");JLabella1=newJLabel("");JLabella2=newJLabel("");JButtonsureButton=newJButton("查询确认");JButtonbuyButton=newJButton("确认购票");publicpan3(){buyButton.addActionListener(newActionListener(){@Overridepu