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

📄 xiaofeiframe.java~36~

📁 机房网吧刷卡计费
💻 JAVA~36~
字号:
package cn.com.S1t55.killer.view;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.util.Date;

import javax.swing.*;

import cn.com.S1t55.killer.business.ComBusiness;
import cn.com.S1t55.killer.business.RecordBuiness;
import cn.com.S1t55.killer.entity.Computer;
import cn.com.S1t55.killer.entity.Record;
import cn.com.S1t55.killer.business.CardBusiness;
import cn.com.S1t55.killer.entity.Card;
import java.text.SimpleDateFormat;
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class XiaoFeiFrame extends JFrame {
    JPanel contentPane;
    JLabel txtCard = new JLabel();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    JLabel txtComputer = new JLabel();
    JLabel jLabel5 = new JLabel();
    JLabel txtShangTime = new JLabel();
    JLabel jLabel7 = new JLabel();
    JLabel txtXiao = new JLabel();
    JLabel jLabel9 = new JLabel();
    JLabel txtYu = new JLabel();
    JButton btnCha = new JButton();
    JButton btnXia = new JButton();
    JLabel jLabel1 = new JLabel();
    JLabel txtDangTime = new JLabel();
    public XiaoFeiFrame() {
        try {
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    /**
     * Component initialization.
     *
     * @throws java.lang.Exception
     */
    private void jbInit() throws Exception {
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(null);
        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        setSize(new Dimension(400, 400));
        setTitle("消费信息");
        txtCard.setText("");
        txtCard.setBounds(new Rectangle(148, 30, 205, 33));
        jLabel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        jLabel2.setText("卡ID");
        jLabel2.setBounds(new Rectangle(81, 30, 53, 35));
        jLabel3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        jLabel3.setText("机器ID");
        jLabel3.setBounds(new Rectangle(78, 79, 56, 26));
        txtComputer.setText("");
        txtComputer.setBounds(new Rectangle(146, 75, 162, 31));
        jLabel5.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        jLabel5.setText("上机时间");
        jLabel5.setBounds(new Rectangle(73, 120, 59, 27));
        txtShangTime.setText("");
        txtShangTime.setBounds(new Rectangle(143, 113, 151, 38));
        jLabel7.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        jLabel7.setText("消费金额");
        jLabel7.setBounds(new Rectangle(72, 188, 59, 32));
        txtXiao.setText("");
        txtXiao.setBounds(new Rectangle(150, 189, 130, 33));
        jLabel9.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        jLabel9.setText("余额");
        jLabel9.setBounds(new Rectangle(87, 229, 33, 28));
        txtYu.setText("");
        txtYu.setBounds(new Rectangle(156, 230, 127, 27));
        btnCha.setBounds(new Rectangle(80, 286, 75, 26));
        btnCha.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        btnCha.setText("查询");
        btnCha.addActionListener(new XiaoFeiFrame_btnCha_actionAdapter(this));
        btnXia.setBounds(new Rectangle(257, 285, 73, 26));
        btnXia.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        btnXia.setText("下机");
        btnXia.addActionListener(new XiaoFeiFrame_btnXia_actionAdapter(this));
        jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        jLabel1.setText("当前时间");
        jLabel1.setBounds(new Rectangle(70, 156, 63, 27));
        txtDangTime.setText("");
        txtDangTime.setBounds(new Rectangle(135, 154, 175, 28));
        contentPane.add(txtCard);
        contentPane.add(jLabel2);
        contentPane.add(jLabel3);
        contentPane.add(txtComputer);
        contentPane.add(jLabel5);
        contentPane.add(txtShangTime);
        contentPane.add(jLabel9);
        contentPane.add(jLabel7);
        contentPane.add(txtXiao);
        contentPane.add(btnCha);
        contentPane.add(btnXia);
        contentPane.add(jLabel1);
        contentPane.add(txtDangTime);
        contentPane.add(txtYu);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
       Dimension frameSize = this.getSize();
       if (frameSize.height > screenSize.height) {
           frameSize.height = screenSize.height;
       }
       if (frameSize.width > screenSize.width) {
           frameSize.width = screenSize.width;
       }
       this.setLocation((screenSize.width - frameSize.width) / 2,
                    (screenSize.height - frameSize.height) / 2);

    }

    public void btnCha_actionPerformed(ActionEvent e) {
        /*查询把为得到的卡号,上机器时间,机器Id.*/
         txtCard.setText(Record.cardId);
          txtComputer.setText(Record.computerId);
          txtShangTime.setText(Record.beginTime);
          Date Time=new Date();
          SimpleDateFormat df;
      df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
      String bs=df.format(Time);
      double fee=JiSuan.FeiYong(bs);
           double yu=Record.balance-fee;
           txtDangTime.setText(bs);
           txtXiao.setText(""+fee);
           txtYu.setText(""+yu);

    }

    public void btnXia_actionPerformed(ActionEvent e) {
        txtCard.setText(Record.cardId);
              txtComputer.setText(Record.computerId);
              txtShangTime.setText(Record.beginTime);
              Date Time=new Date();
              SimpleDateFormat df;
		df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
              String as=df.format(Time);
              double fee=JiSuan.FeiYong(as);
              double yu=Record.balance-fee;
              txtDangTime.setText(as);
          txtXiao.setText(""+fee);
           txtYu.setText(""+yu);
          Record Cha=new Record();
          Cha.setCardId(Record.cardId);
          Cha.setComputerId(Record.computerId);
          Cha.setBeginTime(Record.beginTime);
          Cha.setBeginTime(Record.beginTime);
          Cha.setEndTime(as);
          Cha.setBalance(yu);
        RecordBuiness.insert(Cha);
        Card s=new Card();
       s.setId(Record.cardId);
       s.setBalance(yu);
       CardBusiness.GengXin(s);

        Computer gen=new Computer();
         gen.setId(Record.computerId);
         gen.setOnUse(0);
          gen.setNotes("闲置");
           ComBusiness.update(gen);
          System.exit(1);

    }
}


class XiaoFeiFrame_btnXia_actionAdapter implements ActionListener {
    private XiaoFeiFrame adaptee;
    XiaoFeiFrame_btnXia_actionAdapter(XiaoFeiFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.btnXia_actionPerformed(e);
    }
}


class XiaoFeiFrame_btnCha_actionAdapter implements ActionListener {
    private XiaoFeiFrame adaptee;
    XiaoFeiFrame_btnCha_actionAdapter(XiaoFeiFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.btnCha_actionPerformed(e);
    }
}

⌨️ 快捷键说明

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