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

📄 hims_account.java

📁 本文是用JAVA语言编写的,直接下载就可以 不要解压密码
💻 JAVA
字号:
package com.account;import java.sql.*;import java.util.Vector;import javax.swing.*;import com.dbmanage.*;import com.borland.jbcl.layout.*;import java.awt.*;import java.awt.event.*;import com.Register.*;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 HIMS_Account extends JPanel{  XYLayout xYLayout1 = new XYLayout();  JLabel jLabel1 = new JLabel();  JButton jButton1 = new JButton();  JLabel jLabel2 = new JLabel();  JTextField jTextField1 = new JTextField();  JTextField jTextField2 = new JTextField();  JLabel jLabel3 = new JLabel();  JLabel jLabel4 = new JLabel();  JTextField jTextField3 = new JTextField();  JLabel jLabel5 = new JLabel();  JTextField jTextField4 = new JTextField();  JLabel jLabel6 = new JLabel();  JTextField jTextField5 = new JTextField();  JLabel jLabel7 = new JLabel();  JTextField jTextField6 = new JTextField();  JLabel jLabel8 = new JLabel();  JTextField jTextField7 = new JTextField();  JLabel jLabel9 = new JLabel();  JTextField jTextField8 = new JTextField();  JLabel jLabel10 = new JLabel();  JTextField jTextField9 = new JTextField();  JLabel jLabel11 = new JLabel();  JTextField jTextField10 = new JTextField();/////////////////////////  //     int AccountNo;//帐单号与客人的ID相同     String Name; //客人姓名     String RoomNo; //房间识别号     String iClass;   // 房间类别     float StandardPri;//标准价     float RebatePri;//折后价     float Deposit;//  押金     float Reckoning;//结帐     String  IsBill;//是否开发票     String Operator;  JButton jButton2 = new JButton();//操作员  public HIMS_Account() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  private void jbInit() throws Exception {    this.setLayout(xYLayout1);    jLabel1.setFont(new java.awt.Font("SansSerif", 1, 20));    jLabel1.setForeground(Color.black);    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);    jLabel1.setIconTextGap(4);    jLabel1.setText("客人帐单显示");    xYLayout1.setWidth(575);    xYLayout1.setHeight(616);    jButton1.setFont(new java.awt.Font("SansSerif", 1, 15));    jButton1.setText("打印");    jButton1.addActionListener(new HIMS_Account_jButton1_actionAdapter(this));    jLabel2.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel2.setForeground(Color.black);    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);    jLabel2.setText("帐单编号");    jTextField1.setText("");    jTextField2.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("房间识别号");    jTextField3.setText("");    jLabel5.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel5.setForeground(Color.black);    jLabel5.setHorizontalAlignment(SwingConstants.CENTER);    jLabel5.setText("房间类别");    jTextField4.setText("");    jLabel6.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel6.setForeground(Color.black);    jLabel6.setHorizontalAlignment(SwingConstants.CENTER);    jLabel6.setText("标准价");    jTextField5.setText("");    jLabel7.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel7.setForeground(Color.black);    jLabel7.setHorizontalAlignment(SwingConstants.CENTER);    jLabel7.setText("折扣价");    jTextField6.setText("");    jLabel8.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel8.setForeground(Color.black);    jLabel8.setHorizontalAlignment(SwingConstants.CENTER);    jLabel8.setText("押金");    jTextField7.setText("");    jLabel9.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel9.setForeground(Color.black);    jLabel9.setHorizontalAlignment(SwingConstants.CENTER);    jLabel9.setText("结帐");    jTextField8.setText("");    jLabel10.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel10.setForeground(Color.black);    jLabel10.setText("是否开发票");    jTextField9.setText("");    jLabel11.setFont(new java.awt.Font("SansSerif", 1, 15));    jLabel11.setForeground(Color.black);    jLabel11.setText("操作员");    jTextField10.setText("");    jButton2.setFont(new java.awt.Font("SansSerif", 1, 15));    jButton2.setForeground(Color.black);    jButton2.setText("提交");    jButton2.addActionListener(new HIMS_Account_jButton2_actionAdapter(this));    jTextField5.setEditable(false);    jTextField6.setEditable(false);    jTextField7.setEditable(false);    jTextField10.setEditable(false);    jTextField3.setEditable(false);    jTextField4.setEditable(false);    jTextField1.setDoubleBuffered(false);    jTextField1.setEditable(false);    jTextField2.setEditable(false);    this.setBackground(SystemColor.info);    this.add(jLabel1,  new XYConstraints(103, 22, 227, 35));    this.add(jLabel2, new XYConstraints(30, 80, 80, 35));    this.add(jTextField1, new XYConstraints(130, 80, 100,35));    this.add(jLabel3, new XYConstraints(270, 80, 80, 35));    this.add(jTextField2, new XYConstraints(400, 80, 100, 35));    this.add(jLabel4,  new XYConstraints(30, 170, 80, 35));    this.add(jTextField3,  new XYConstraints(130, 170, 100, 35));    this.add(jLabel5, new XYConstraints(270, 170, 80, 35));    this.add(jTextField4, new XYConstraints(400, 170, 100, 35));    this.add(jLabel6,  new XYConstraints(30, 260, 80, 35));    this.add(jTextField5,  new XYConstraints(130, 260, 100, 35));    this.add(jLabel7,  new XYConstraints(270, 260, 80, 35));    this.add(jTextField6,  new XYConstraints(400, 260, 100, 35));    this.add(jLabel8,  new XYConstraints(30, 350, 80, 35));    this.add(jTextField7,  new XYConstraints(130, 350, 100, 35));    this.add(jLabel9,  new XYConstraints(270, 350, 80, 35));    this.add(jTextField8,  new XYConstraints(400, 350, 100, 35));    this.add(jLabel10,  new XYConstraints(30, 440, 80, 35));    this.add(jTextField9,   new XYConstraints(130, 440, 100, 35));    this.add(jLabel11, new XYConstraints(30, 530, 80, 35));    this.add(jTextField10,   new XYConstraints(130, 530,100, 35));    this.add(jButton1,  new XYConstraints(325, 530, 80, 35));    this.add(jButton2,  new XYConstraints(456, 530, 85, 37));   ///////////////////////////////////////   HIMSRegister hIMSRegister =new HIMSRegister();  AccountNo=hIMSRegister.IDint;  System.out.println("AccountNo***:" + AccountNo);  Name= new String(hIMSRegister.Name); //客人姓名  RoomNo= hIMSRegister.GetRoom(); //房间识别号  iClass= hIMSRegister.Class;   // 房间类别  StandardPri= hIMSRegister.StandardPri;//标准价  RebatePri= hIMSRegister.RebatePri;//折后价  Deposit= hIMSRegister.Deposit;//  押金  Reckoning=hIMSRegister.Total;//结帐  IsBill="是";//是否开发票  Operator= hIMSRegister.Operator;//操作员      //       jTextField1.setText(Integer.toString(AccountNo));       jTextField2.setText(Name);       jTextField3.setText(RoomNo);       jTextField4.setText(iClass);       jTextField5.setText(Float.toString(StandardPri));//标准价       jTextField6.setText(Float.toString(RebatePri));       jTextField7.setText(Float.toString(Deposit));       jTextField8.setText(Float.toString(Reckoning));//结帐       jTextField9.setText(IsBill);//是否开发票       String ReckoningStr= jTextField8.getText();//结帐       Reckoning=Float.parseFloat(ReckoningStr);       IsBill= jTextField9.getText();//是否开发票       jTextField10.setText(Operator); System.out.println("RoomNo:" +RoomNo);       System.out.println("NamevName:" +Name);       System.out.println(iClass);       System.out.println("SSSS"+StandardPri);       System.out.println("RRRRR"+RebatePri);       System.out.println("Deposit::" +Deposit);        System.out.println("-----------------------------");       System.out.println(Name);        System.out.println("================================");       System.out.println(Operator);  }//private void jbInit()  void jButton1_actionPerformed(ActionEvent e) {//打印  }  public void jButton2_actionPerformed(ActionEvent e) {//提交数据库    String insertString =//不包括ID   "INSERT INTO HIMS_Account(AccountNo,Name,RoomNo,Class,StandardPri,RebatePri,Deposit,Reckoning,IsBill,Operator) VALUES("   +new Integer(AccountNo)+",'" +Name+"','"+RoomNo+"','"+iClass+"',"+new Float(StandardPri)+","+new Float(RebatePri)+","   +new Float(Deposit)+","+new Float(Reckoning)+",'"+IsBill+"','"+Operator+"')"; //查询语句    try{      JDBCFile conn3 = new JDBCFile(); //得到一个对象      //int count1=stmt.executeUpdate("INSERT INTO testTable(id,name) VALUES(1,'wu')");       int flag=conn3.insert(insertString);       //if()System.out.println("");     }catch(Exception ex2){       System.out.println(ex2);              }  }}//////end private void jbInit()class HIMS_Account_jButton1_actionAdapter implements java.awt.event.ActionListener {  HIMS_Account adaptee;  HIMS_Account_jButton1_actionAdapter(HIMS_Account adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}class HIMS_Account_jButton2_actionAdapter implements java.awt.event.ActionListener {  HIMS_Account adaptee;  HIMS_Account_jButton2_actionAdapter(HIMS_Account adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton2_actionPerformed(e);  }}

⌨️ 快捷键说明

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