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

📄 outnetting.java

📁 网吧管理系统JAVA代码
💻 JAVA
字号:
package netbar;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

public class OutNetting extends JFrame {
    public static String computerId;
    public static String cardId;
    public static String begintime;
    public static String endtime;
    public static int fee;
    public static int nowbalance;
    LandingOfManager landingofmanager=new LandingOfManager();
    ArrayList array=new ArrayList();
    OutNettingDate outnettingdate=new OutNettingDate();
    public OutNetting() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(null);
        jPanel1.setBorder(BorderFactory.createEtchedBorder());
        jPanel1.setBounds(new Rectangle(53, 55, 79, 35));
        txtComputerId.setFont(new java.awt.Font("楷体_GB2312", Font.BOLD, 15));
        txtComputerId.setBounds(new Rectangle(147, 55, 141, 35));
        txtEndTime.setFont(new java.awt.Font("Dialog", Font.BOLD, 13));
        txtEndTime.setEditable(false);
        txtEndTime.setBounds(new Rectangle(148, 103, 141, 35));
        btnOK.setBounds(new Rectangle(90, 157, 80, 40));
        btnOK.setFont(new java.awt.Font("楷体_GB2312", Font.BOLD, 15));
        btnOK.setText("确定");
        btnOK.addActionListener(new OutNetting_btnOK_actionAdapter(this));
        btnReset.setBounds(new Rectangle(221, 157, 80, 40));
        btnReset.setFont(new java.awt.Font("楷体_GB2312", Font.BOLD, 15));
        btnReset.setText("重置");
        btnReset.addActionListener(new OutNetting_btnReset_actionAdapter(this));
        this.getContentPane().add(jPanel2);
        jPanel2.add(jLabel2);
        jLabel1.setFont(new java.awt.Font("楷体_GB2312", Font.BOLD, 15));
        jLabel1.setText("机器号:");
        this.getContentPane().add(jPanel1);
        this.getContentPane().add(txtComputerId);
        this.getContentPane().add(txtEndTime);
        this.getContentPane().add(btnReset);
        this.getContentPane().add(btnOK);
        jLabel2.setFont(new java.awt.Font("楷体_GB2312", Font.BOLD, 15));
        jLabel2.setText("下机时间:");
        jPanel1.add(jLabel1);
        jPanel2.setBorder(BorderFactory.createEtchedBorder());
        jPanel2.setBounds(new Rectangle(53, 103, 79, 35));
        this.setResizable(false);
        txtEndTime.setText(GetTime.gettime());
        array=outnettingdate.getcomputerId();//获得正在使用的机器号
        for(int i=0;i<array.size();i++){
         txtComputerId.addItem(array.get(i));
         }

    }

    JPanel jPanel1 = new JPanel();
    JPanel jPanel2 = new JPanel();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JComboBox txtComputerId = new JComboBox();
    JTextField txtEndTime = new JTextField();
    JButton btnOK = new JButton();
    JButton btnReset = new JButton();
    public void btnOK_actionPerformed(ActionEvent e) {
        computerId=txtComputerId.getSelectedItem().toString();
        endtime=txtEndTime.getText();
        begintime=outnettingdate.getbegintime(computerId);//获得开始时间
        cardId=outnettingdate.getCardId(begintime,computerId);//获得下机的卡号
        fee=outnettingdate.getFeeOfOutNet(begintime,endtime);//获得下机费用
        nowbalance=outnettingdate.getbalance(fee,cardId);//获得现在所剩的余额
        int usefee=outnettingdate.getusefee(fee,cardId);//计算总的用费
        //System.out .println(begintime+"卡号"+cardId+"用费"+fee+"现在余额"+nowbalance+"用费情况"+usefee);
        outnettingdate.notedateOfRecord( endtime,fee,computerId,cardId,begintime);  //Record记录数据
        outnettingdate.reworkdateOfCard(usefee,nowbalance,cardId);//Card记录数据
        String cardIdofmanager=landingofmanager.cardId;//获得当前管理员的卡号
        int gain=outnettingdate.notefee(fee,cardIdofmanager);//积累收费情况//更新管理员收费的情况
       // System.out.println("收费"+gain);
        outnettingdate.reworkofGain(gain,cardIdofmanager);
       // System.out.println("管理员卡号"+cardIdofmanager);
        outnettingdate.reworkcomputercase(computerId);//更新机器的状态
        JOptionPane.showMessageDialog(this,"成功下机");
        DisplayConsumeCase displayconsumecase=new DisplayConsumeCase();
        displayconsumecase.setSize(400,400);
        displayconsumecase.setTitle("上机情况");
        displayconsumecase.show();
        this.dispose();
    }

    public void btnReset_actionPerformed(ActionEvent e) {
        txtComputerId.setSelectedIndex(0);
    }

}


class OutNetting_btnReset_actionAdapter implements ActionListener {
    private OutNetting adaptee;
    OutNetting_btnReset_actionAdapter(OutNetting adaptee) {
        this.adaptee = adaptee;
    }

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


class OutNetting_btnOK_actionAdapter implements ActionListener {
    private OutNetting adaptee;
    OutNetting_btnOK_actionAdapter(OutNetting adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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