⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 himsregister.java

📁 基于java的一个小应用程序开发与应用
💻 JAVA
字号:
package com.Register;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.*;import java.awt.event.*;import com.dbmanage.*;import com.account.*;import com.*;import java.sql.*;/** * <p>Title:宾馆房客登记表 </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class HIMSRegister extends JPanel{  JLabel jLabel0 = new JLabel();  XYLayout xYLayout1 = new XYLayout();  JLabel jLabel1 = new JLabel();  JLabel jLabel2 = new JLabel();  JLabel jLabel3 = new JLabel();  JLabel jLabel4 = new JLabel();  JLabel jLabel5 = new JLabel();  JLabel jLabel6 = new JLabel();  JTextField jTextField1 = new JTextField();  JTextField jTextField2 = new JTextField();  JTextField jTextField3 = new JTextField();  JTextField jTextField4 = new JTextField();  JTextField jTextField5 = new JTextField();  JTextField jTextField6 = new JTextField();  JLabel jLabel7 = new JLabel();  JLabel jLabel8 = new JLabel();  JTextField jTextField7 = new JTextField();  JTextField jTextField8 = new JTextField();  JLabel jLabel9 = new JLabel();  JTextField jTextField9 = new JTextField();  JLabel jLabel10 = new JLabel();  JTextField jTextField10 = new JTextField();  JLabel jLabel11 = new JLabel();  JTextField jTextField11 = new JTextField();  JLabel jLabel12 = new JLabel();  JTextField jTextField12 = new JTextField();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  //////////////////  public  int IDint;//ID号   public String RoomNo; //房间识别号   public String Class;   // 房间类别  public float StandardPri;//标准价   public float RebatePri;//折后价   public float Deposit;//  押金  public  float Total;//总额  public String Name ;//客人姓名   public String IDTitle;// 证件名称   public long IDNo;//  证件号码   public String Reason;// 住宿原因   public int CustNo;// 住宿人数  public  String Operator;  public String GetRoom()  {    return RoomNo;  }  JLabel IDLabel = new JLabel();  JTextField jTextField0 = new JTextField();// 操作员  public HIMSRegister() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  private void jbInit() throws Exception {    jLabel0.setFont(new java.awt.Font("SansSerif", 1, 20));    jLabel0.setForeground(SystemColor.textText);    jLabel0.setHorizontalAlignment(SwingConstants.CENTER);    jLabel0.setText("酒店客房预定界面");    this.setLayout(xYLayout1);    jLabel1.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel1.setForeground(Color.black);    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);    jLabel1.setHorizontalTextPosition(SwingConstants.TRAILING);    jLabel1.setText("客房号");    jLabel2.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);    jLabel2.setText("客房类别");    jLabel3.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel3.setForeground(Color.black);    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);    jLabel3.setText("标准价");    jLabel4.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel4.setForeground(Color.black);    jLabel4.setHorizontalAlignment(SwingConstants.CENTER);    jLabel4.setText("折扣价");    jLabel5.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel5.setForeground(Color.black);    jLabel5.setHorizontalAlignment(SwingConstants.CENTER);    jLabel5.setText("押金");    jLabel6.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel6.setForeground(Color.black);    jLabel6.setHorizontalAlignment(SwingConstants.CENTER);    jLabel6.setText("总额");    jTextField1.setText("");    jTextField2.setText("");    jTextField3.setText("");    jTextField4.setText("");    jTextField5.setText("");    jTextField6.setText("");    this.setBackground(new Color(58, 144, 171));    this.setFont(new java.awt.Font("SansSerif", 1, 15));    this.setToolTipText("");    jLabel7.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel7.setForeground(Color.black);    jLabel7.setHorizontalAlignment(SwingConstants.CENTER);    jLabel7.setText("客人姓名");    jLabel8.setBackground(SystemColor.controlLtHighlight);    jLabel8.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel8.setForeground(Color.black);    jLabel8.setHorizontalAlignment(SwingConstants.CENTER);    jLabel8.setText("证件类别");    jTextField7.setText("");    jTextField8.setText("");    jLabel9.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel9.setForeground(Color.black);    jLabel9.setHorizontalAlignment(SwingConstants.CENTER);    jLabel9.setText("证件号");    jTextField9.setText("");    xYLayout1.setWidth(631);    xYLayout1.setHeight(543);    jLabel10.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel10.setForeground(Color.black);    jLabel10.setText("入住原因");    jTextField10.setText("");    jLabel11.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel11.setForeground(Color.black);    jLabel11.setText("入住人数");    jTextField11.setText("");    jLabel12.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel12.setForeground(Color.black);    jLabel12.setText("工作人员");    jTextField12.setText("");    jButton1.setFont(new java.awt.Font("SansSerif", 1, 15));    jButton1.setForeground(SystemColor.textText);    jButton1.setText("重置");    jButton1.addActionListener(new HIMSRegister_jButton1_actionAdapter(this));    jButton2.setFont(new java.awt.Font("SansSerif", 1, 15));    jButton2.setForeground(Color.black);    jButton2.setText("提交");    jButton2.addActionListener(new HIMSRegister_jButton2_actionAdapter(this));    IDLabel.setFont(new java.awt.Font("SansSerif", 1, 15));    IDLabel.setForeground(Color.black);    IDLabel.setAlignmentX((float) 0.0);    IDLabel.setHorizontalAlignment(SwingConstants.CENTER);    IDLabel.setText("登记ID号");    jTextField0.setText("");    this.add(jLabel1, new XYConstraints(25, 50, 70, 30));    this.add(jLabel2, new XYConstraints(440, 50, 70, 30));    this.add(jLabel3, new XYConstraints(25, 100,70, 30));    this.add(jLabel4, new XYConstraints(440, 100, 70, 30));    this.add(jLabel6, new XYConstraints(440, 150, 70, 30));    this.add(jLabel7, new XYConstraints(20, 200, 70, 30));    this.add(jLabel8, new XYConstraints(20, 250, 70, 30));    this.add(jTextField1, new XYConstraints(100, 50, 100, 30));    this.add(jTextField2, new XYConstraints(520, 50, 100, 30));    this.add(jTextField3, new XYConstraints(100, 100, 100, 30));    this.add(jTextField4, new XYConstraints(520, 100,100, 30));    this.add(jTextField5, new XYConstraints(100, 150, 100, 30));    this.add(jTextField6, new XYConstraints(520, 150, 100, 30));    this.add(jTextField7, new XYConstraints(100, 200, 100, 30));    this.add(jTextField8, new XYConstraints(100, 250, 100, 30));    this.add(jLabel9,  new XYConstraints(440, 250, 70, 30));    this.add(jTextField9,  new XYConstraints(520, 250, 100, 30));    this.add(jLabel10, new XYConstraints(20, 300, 70, 30));    this.add(jTextField10, new XYConstraints(100, 300, 200, 30));    this.add(jLabel11, new XYConstraints(20, 350, 70, 30));   this.add(jTextField11, new XYConstraints(100, 350, 200, 30));    this.add(jLabel12,  new XYConstraints(25, 400, 50, 30));    this.add(jTextField12,  new XYConstraints(100, 400, 100, 30));   this.add(jButton1, new XYConstraints(200, 450, 100, 35));    this.add(IDLabel,  new XYConstraints(440, 346, 80, 35));    this.add(jTextField0,  new XYConstraints(520, 336, 100, 35));    this.add(jLabel0,   new XYConstraints(241, 8, 178, -1));    this.add(jButton2, new XYConstraints(384, 450, 100, 35));    this.add(jLabel5, new XYConstraints(20, 163, 70, 30));  }  void jButton1_actionPerformed(ActionEvent e) {//重置      jTextField0.setText("");      jTextField1.setText("");      jTextField2.setText("");      jTextField3.setText("");      jTextField4.setText("");      jTextField5.setText("");      jTextField6.setText("");      jTextField7.setText("");      jTextField8.setText("");      jTextField9.setText("");      jTextField10.setText("");      jTextField11.setText("");      jTextField12.setText("");  }  void jButton2_actionPerformed(ActionEvent e) {//提交数据库 //ID号应该自动生成 IDint=Integer.parseInt(jTextField0.getText()); RoomNo=jTextField1.getText(); //房间识别号 Class=jTextField2.getText();   // 房间类别 StandardPri=Float.parseFloat(jTextField3.getText());//标准价 RebatePri=Float.parseFloat(jTextField4.getText());//折后价 Deposit=Float.parseFloat(jTextField5.getText());//  押金 Total=Float.parseFloat(jTextField6.getText());//总额 Name=jTextField7.getText();  //客人姓名 IDTitle=jTextField8.getText();// 证件名称 IDNo=Long.parseLong(jTextField9.getText());//  证件号码 Reason=jTextField10.getText();// 住宿原因 CustNo=Integer.parseInt(jTextField11.getText());// 住宿人数 Operator=jTextField12.getText();// 操作员 String insertString =//不包括ID        "INSERT INTO HIMS_REGISTER(ID,RoomNo,Class,StandardPri,RebatePri,Deposit,Total,Name, IDTitle,IDNo,Reason,CustNo,Operator) VALUES("       +new Integer(IDint)+"," +"'"+RoomNo+"','"+Class+"',"+new Float(StandardPri)+","+new Float(RebatePri)+","       +new Float(Deposit)+","+new Float(Total) +",'"+Name+"','"+IDTitle+"',"+new Long(IDNo)+",'"       +Reason+"',"+new Integer(CustNo)+",'"+Operator+"'"+")"; //查询语句   System.out.println("IDint***:" + IDint);    try{   JDBCFile conn2 = new JDBCFile(); //得到一个对象    int flag=conn2.insert(insertString);  }catch(Exception ex2){    System.out.println(ex2);           } }}//end public class///////////////////class HIMSRegister_jButton1_actionAdapter implements java.awt.event.ActionListener {  HIMSRegister adaptee;//重置  HIMSRegister_jButton1_actionAdapter(HIMSRegister adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}class HIMSRegister_jButton2_actionAdapter implements java.awt.event.ActionListener {  HIMSRegister adaptee;//提交数据库  HIMSRegister_jButton2_actionAdapter(HIMSRegister adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton2_actionPerformed(e);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -