ImageVerifierCode 换一换
格式:DOC , 页数:44 ,大小:159.50KB ,
资源ID:3869671      下载积分:5 金币
验证码下载
登录下载
邮箱/手机:
验证码: 获取验证码
温馨提示:
支付成功后,系统会自动生成账号(用户名为邮箱或者手机号,密码是验证码),方便下次登录下载和查询订单;
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/3869671.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  
声明  |  会员权益     获赠5币     写作写作

1、填表:    下载求助     索取发票    退款申请
2、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
3、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
4、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
5、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前自行私信或留言给上传者【天****】。
6、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
7、本文档遇到问题,请及时私信或留言给本站上传会员【天****】,需本站解决可联系【 微信客服】、【 QQ客服】,若有其他问题请点击或扫码反馈【 服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【 版权申诉】”(推荐),意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4008-655-100;投诉/维权电话:4009-655-100。

注意事项

本文(火车售票系统完整代码教学内容.doc)为本站上传会员【天****】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4008-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

火车售票系统完整代码教学内容.doc

1、火车售票系统完整代码精品文档package com.yue;import java.awt.Color;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.CallableStatement;import java.sql.Connection;import java.sql.DriverManager;import java.sql.Resul

2、tSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextArea;import javax.swing.JTextField;publ

3、ic class BuyPanel extends JPanel StringBuffer sb = new StringBuffer();private boolean flag = false;JTextArea jtArea = new JTextArea(10, 78);JLabel buyLabel = new JLabel(订票);JTextField fId = new JTextField(7);JTextField ftid = new JTextField(7);JTextField fche = new JTextField(7);JTextField fzhangshu

4、 = new JTextField(7);JTextField fbodyId = new JTextField(7);JPasswordField jpField = new JPasswordField(7);public JPanel getBuypn() JPanel pan = new JPanel();GridBagLayout layout = new GridBagLayout();pan.setLayout(layout);GridBagConstraints con = getGridBagConstraints(0, 0, 1, 1, 100, 100,GridBagCo

5、nstraints.NONE, GridBagConstraints.WEST);pan.add(buyLabel, con);con = getGridBagConstraints(0, 2, 1, 1, 100, 100,GridBagConstraints.NONE, GridBagConstraints.WEST);pan.add(new pan3(), con);con = getGridBagConstraints(0, 3, 1, 1, 100, 100,GridBagConstraints.NONE, GridBagConstraints.WEST);pan.add(new p

6、an4(), con);con = getGridBagConstraints(0, 4, 1, 1, 100, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);pan.add(new pan5(), con);this.setLocation(270, 150);this.add(pan);return pan;/* * 定义下面购票操作区面板pan3 * * author Administrator * */class pan3 extends JPanel JLabel lId = new JLabel( 车票号码 );JLab

7、el ltid = new JLabel( 车票号码 );JLabel che = new JLabel( 车 次 );JLabel lbodyId = new JLabel( 身份证号 );JLabel password = new JLabel( 密码 );JLabel lzhangshu = new JLabel( 所需张数 );JLabel la1 = new JLabel( );JLabel la2 = new JLabel( );JButton sureButton = new JButton(查询确认);JButton buyButton = new JButton(确认购票);

8、public pan3() buyButton.addActionListener(new ActionListener()Overridepublic void actionPerformed(ActionEvent e) UpdateUser();if (flag=true)UpdateTrain();System.out.println(hjkasfhjkaf););sureButton.addActionListener(new ActionListener() Overridepublic void actionPerformed(ActionEvent e) select(););

9、GridBagLayout layout = new GridBagLayout();this.setLayout(layout);GridBagConstraints con = getGridBagConstraints(0, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(lId, con);con = getGridBagConstraints(1, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);th

10、is.add(fId, con);con = getGridBagConstraints(8, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(la2, con);con = getGridBagConstraints(9, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(sureButton, con);con = getGridBagConstraints(0, 1, 1, 1, 0, 1

11、00,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(ltid, con);con = getGridBagConstraints(1, 1, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(ftid, con);con = getGridBagConstraints(2, 1, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(che,

12、 con);con = getGridBagConstraints(3, 1, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(fche, con);con = getGridBagConstraints(4, 1, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(lbodyId, con);con = getGridBagConstraints(5, 1, 1, 1, 0, 100,GridBagCon

13、straints.NONE, GridBagConstraints.EAST);this.add(fbodyId, con);con = getGridBagConstraints(0, 2, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(password, con);con = getGridBagConstraints(1, 2, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(jpField, c

14、on);con = getGridBagConstraints(2, 2, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(lzhangshu, con);con = getGridBagConstraints(3, 2, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(fzhangshu, con);con = getGridBagConstraints(8, 2, 1, 1, 0, 100,GridB

15、agConstraints.NONE, GridBagConstraints.EAST);this.add(la1, con);con = getGridBagConstraints(9, 2, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(buyButton, con);this.setBorder(BorderFactory.createTitledBorder(订票操作区);/* * 定义下面一个JList用于显示车票的所有信息面板pan4 * * author Administrator

16、* */class pan4 extends JPanel JButton btId = new JButton(车票号码);JButton bt1 = new JButton(起 点 站);JButton bt2 = new JButton(终 点 站);JButton bt3 = new JButton(车 次);JButton bt4 = new JButton(发车时间);JButton bt5 = new JButton(到达时间);JButton bt6 = new JButton(座位类型);JButton bt7 = new JButton(发车日期);JButton bt8

17、= new JButton(剩余票数);JButton bt9 = new JButton(车票价格);public pan4() this.setLayout(new GridBagLayout();GridBagConstraints con = getGridBagConstraints(0, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(btId, con);con = getGridBagConstraints(1, 0, 1, 1, 0, 100,GridBagConstrain

18、ts.NONE, GridBagConstraints.EAST);this.add(bt1, con);con = getGridBagConstraints(2, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt2, con);con = getGridBagConstraints(3, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt3, con);con = getGridBa

19、gConstraints(4, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt4, con);con = getGridBagConstraints(5, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt5, con);con = getGridBagConstraints(6, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagCons

20、traints.EAST);this.add(bt6, con);con = getGridBagConstraints(7, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt7, con);con = getGridBagConstraints(8, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt8, con);con = getGridBagConstraints(9, 0, 1

21、, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt9, con);con = getGridBagConstraints(0, 1, 11, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(jtArea, con);jtArea.setBackground(Color.GREEN);/* * 定义最下面的按钮面板pan5 * * author Administrator * */class pan5 exten

22、ds JPanel JButton bt1 = new JButton(退出登录);JLabel lab1 = new JLabel( );public pan5() GridBagLayout layout = new GridBagLayout();this.setLayout(layout);GridBagConstraints con = getGridBagConstraints(0, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(bt1, con);con = getGridBa

23、gConstraints(1, 0, 1, 1, 0, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);this.add(lab1, con);bt1.addActionListener(new ActionListener() Overridepublic void actionPerformed(ActionEvent e) System.exit(0););/* * 放回一个网格包约束 * * param x * param y * param width * param heigh * param weighx * param

24、 weighy * param fill * param anchor * return */private GridBagConstraints getGridBagConstraints(int x, int y, int width,int heigh, int weighx, int weighy, int fill, int anchor) GridBagConstraints con = new GridBagConstraints();con.gridx = x;con.gridy = y;con.gridwidth = width;con.gridheight = heigh;

25、con.weightx = weighx;con.weighty = weighy;con.fill = fill;con.anchor = anchor;return con;/* * 按车票号码搜索所有的车票信息 * * throws SQLException */private void select() Connection conn = null;Statement stmt = null;ResultSet ticket = null;try conn = DriverManager.getConnection(jdbc:oracle:thin:127.0.0.1:1521:ORC

26、L, store, store); catch (SQLException e1) e1.printStackTrace();try stmt = conn.createStatement();String text = select * from train_table + where tid= + + fId.getText() + ;ticket = stmt.executeQuery(text);while (ticket.next() String starter = ticket.getString(starter);String reacher = ticket.getStrin

27、g(reacher);String ticketNumber = ticket.getString(ticketNumber);String startTime = ticket.getString(startTime);String endTime = ticket.getString(endTime);String seatIdNumber = ticket.getString(seatIdNumber);String busDate = ticket.getString(busDate);int ticketNum = ticket.getInt(ticketNum);double pr

28、ice = ticket.getDouble(price);sb.append( + fId.getText() + t+ + starter + t+ + reacher+ t+ + ticketNumber + t + startTime + t+ endTime + t + seatIdNumber + t + busDate + t+ ticketNum + t + price + + n);jtArea.setText(sb.toString();if (sb.length() 0) sb.delete(1, sb.length(); else JOptionPane.showMes

29、sageDialog(new TestFrame(), 无此车!); catch (SQLException e) finally if (ticket != null) try ticket.close(); catch (SQLException e) e.printStackTrace();if (stmt != null) try stmt.close(); catch (SQLException e) e.printStackTrace();if (conn != null) try conn.close(); catch (SQLException e) e.printStackT

30、race();/* * 订票时更新数据库中的车票表 */private void UpdateTrain() String tId=ftid.getText();int num=0;if (fzhangshu.getText().length()0)num=Integer.parseInt(fzhangshu.getText();Connection conn = Getgbc.getconnect();CallableStatement cst = null;try conn.setAutoCommit(false);cst = conn.prepareCall(call train_pro

31、c (?,?);cst.setString(1, tId);cst.setInt(2, num);cst.execute();mit(); catch (SQLException e1) try conn.rollback();JOptionPane.showMessageDialog(new TestFrame(), 客户订票失败!); catch (SQLException e2) JOptionPane.showMessageDialog(new TestFrame(), 客户订票失败!); finally if (cst != null) try cst.close(); catch

32、(SQLException e1) e1.printStackTrace();if (conn != null) try conn.close(); catch (SQLException e1) e1.printStackTrace();/* * 订票时更新数据库中的用户表 */private void UpdateUser() String tId=ftid.getText();String bId=fbodyId.getText();String cID=fche.getText();String pwd=String.valueOf(jpField.getPassword();int

33、num=0;if(bId.equals(EnterFrame.ID)&(pwd.equals(EnterFrame.password)if(fzhangshu.getText().length()0)num=Integer.parseInt(fzhangshu.getText();Connection conn = Getgbc.getconnect();Statement cst = null;try cst = conn.createStatement();cst.executeUpdate(insert into order_table(tid,id_number,t_num,train

34、sum)+ values(+ tId+ ,+ bId+ ,+ cID + ,+num+);JOptionPane.showMessageDialog(new TestFrame(), 客户订票成功!);flag=true; catch (SQLException e1) JOptionPane.showMessageDialog(new TestFrame(), 订票失败!);flag=false; finally if (cst != null) try cst.close(); catch (SQLException e1) e1.printStackTrace();if (conn !=

35、 null) try conn.close(); catch (SQLException e1) e1.printStackTrace();elseJOptionPane.showMessageDialog(new TestFrame(), 您的身份证或密码有误!请查证后再订票); package com.yue;import java.awt.Color;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.event.ActionEvent;import java.awt.event

36、.ActionListener;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;imp

37、ort javax.swing.JTextArea;import javax.swing.JTextField;public class CheckPanel extends JPanel StringBuffer sb = new StringBuffer();JTextField trainField = new JTextField(9);JTextField dateField = new JTextField(9);JTextField stationField = new JTextField(9);JTextField zhiField = new JTextField(9);J

38、TextArea jtArea = new JTextArea(10, 80);JLabel checkLabel = new JLabel(查询);public JPanel getCheckpn() JPanel pan = new JPanel();GridBagLayout layout = new GridBagLayout();pan.setLayout(layout);GridBagConstraints con = getGridBagConstraints(0, 0, 1, 1, 100, 100,GridBagConstraints.NONE, GridBagConstra

39、ints.WEST);pan.add(checkLabel, con);con = getGridBagConstraints(0, 1, 1, 1, 100, 100,GridBagConstraints.NONE, GridBagConstraints.WEST);pan.add(new pan2(), con);con = getGridBagConstraints(0, 3, 1, 1, 100, 100,GridBagConstraints.NONE, GridBagConstraints.WEST);pan.add(new pan4(), con);con = getGridBag

40、Constraints(0, 4, 1, 1, 100, 100,GridBagConstraints.NONE, GridBagConstraints.EAST);pan.add(new pan5(), con);this.setLocation(270, 150);this.add(pan);return pan;/* * 定义上部查询区面pan2 * * author Administrator * */class pan2 extends JPanel JLabel trainLabel = new JLabel( 车 次 );JLabel dateLabel = new JLabel( 日 期 );JLabel stationLabel = new JLabel( 起点站 );JLabel zhiLabel = new JLabel( 终点站 );JLabel l1 = new JLabel( );JLabel l2 = new JLabel( );JButton checkButton = new JButton(查

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服