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

📄 checkinpanel.java~17~

📁 网吧计费系统 通过程序实现网吧计费系统的过程
💻 JAVA~17~
字号:
package com.jbaptech.accp.netbar.client;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.text.*;
import java.util.*;

/**
 * class description here.
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: 北京阿博泰克北大青鸟信息技术有限公司</p>
 *
 * @author Michael Luo
 * @version 1.0
 */
public class CheckInPanel
    extends JPanel {
  /**
   * computerIdDescLabel
   */
  JLabel computerIdDescLabel = new JLabel();
  /**
   * cardIdDescLabel
   */
  JLabel cardIdDescLabel = new JLabel();
  /**
   * cardIdTextField
   */
  JTextField cardIdTextField = new JTextField();
  /**
   * pwdDescLabel
   */
  JLabel pwdDescLabel = new JLabel();
  /**
   * dispalyNowTimeDescLabel
   */
  JLabel dispalyNowTimeDescLabel = new JLabel();
  /**
   * dispalyNowTimeTextField
   */
  JTextField dispalyNowTimeTextField = new JTextField();
  /**
   * confirmButton
   */
  JButton confirmButton = new JButton();
  /**
   * resetButton
   */
  JButton resetButton = new JButton();
  /**
   * passwordFiled
   */
  JPasswordField passwordFiled = new JPasswordField();
  /**
   * computerIdCombox
   */
  JComboBox computerIdCombox = new JComboBox();
  /**
   * nowTime
   */
  java.util.Date nowTime;
  /**
   * constructor.
   * @param mFrame NetBarFeeMangementFrame
   */
  public CheckInPanel(NetBarFeeMangementFrame mFrame) {
    try {
      mainFrame = mFrame;
      jbInit();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  /**
   * init.
   * @throws Exception
   */
  void jbInit() throws Exception {
    this.setLayout(null);

    computerIdDescLabel.setFont(new java.awt.Font("Serif", 0, 13));
    computerIdDescLabel.setHorizontalAlignment(SwingConstants.CENTER);
    computerIdDescLabel.setText("机器号码:");
    computerIdDescLabel.setBounds(new Rectangle(95, 30, 70, 25));

    computerIdCombox.setBounds(new Rectangle(175, 30, 110, 25));

    cardIdDescLabel.setFont(new java.awt.Font("Serif", 0, 13));
    cardIdDescLabel.setHorizontalAlignment(SwingConstants.CENTER);
    cardIdDescLabel.setText("卡        号:");
    cardIdDescLabel.setBounds(new Rectangle(95, 75, 70, 25));

    cardIdTextField.setText("");
    cardIdTextField.setBounds(new Rectangle(175, 75, 110, 25));

    pwdDescLabel.setFont(new java.awt.Font("Serif", 0, 13));
    pwdDescLabel.setHorizontalAlignment(SwingConstants.CENTER);
    pwdDescLabel.setText("密        码:");
    pwdDescLabel.setBounds(new Rectangle(95, 120, 70, 25));

    passwordFiled.setText("");
    passwordFiled.setBounds(new Rectangle(175, 120, 110, 25));

    dispalyNowTimeDescLabel.setFont(new java.awt.Font("Serif", 0, 13));
    dispalyNowTimeDescLabel.setHorizontalAlignment(SwingConstants.CENTER);
    dispalyNowTimeDescLabel.setText("开始时间:");
    dispalyNowTimeDescLabel.setBounds(new Rectangle(95, 165, 70, 25));

    nowTime = new java.util.Date();
    SimpleDateFormat HMFromat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    String dispalyNowTime = HMFromat.format(nowTime);
    dispalyNowTimeTextField.setText(dispalyNowTime);
    dispalyNowTimeTextField.setBounds(new Rectangle(175, 165, 110, 25));
    dispalyNowTimeTextField.setEnabled(false);

    confirmButton.setBounds(new Rectangle(115, 215, 65, 25));
    confirmButton.setText("确认");
    confirmButton.addActionListener(new UseInPanel_confirmButton_actionAdapter(this));

    resetButton.setBounds(new Rectangle(200, 215, 65, 25));
    resetButton.setText("重置");
    resetButton.addActionListener(new UseInPanel_resetButton_actionAdapter(this));

    this.add(cardIdTextField, null);
    this.add(cardIdDescLabel, null);
    this.add(pwdDescLabel, null);
    this.add(dispalyNowTimeDescLabel, null);
    this.add(dispalyNowTimeTextField, null);
    this.add(passwordFiled, null);
    this.add(computerIdDescLabel, null);
    this.add(confirmButton, null);
    this.add(resetButton, null);
    this.add(computerIdCombox, null);

    computerIdCombox.addItem("");

  }

  /**
   * deal business about click reset button.
   * @param e ActionEvent
   */
  void resetButton_actionPerformed(ActionEvent e) {
    computerIdCombox.setSelectedIndex(0);
    cardIdTextField.setText("");
    passwordFiled.setText("");
    dispalyNowTimeTextField.setText("");
  }

  /**
   * deal business about click confirm button.
   * @param e ActionEvent
   */
  void confirmButton_actionPerformed(ActionEvent e) {
    String cardId = "";
    String passwordtemp = "";
    String computerId = "";
    cardId = cardIdTextField.getText().trim();
    for (int i = 0; i < passwordFiled.getPassword().length; i++) {
      passwordtemp += passwordFiled.getPassword()[i];
    }
    computerId = computerIdCombox.getSelectedItem().toString();
    if (computerId == null || computerId.trim().length() == 0) {
      JOptionPane.showMessageDialog(this, "请选择机器号!", "警告",
                                    JOptionPane.WARNING_MESSAGE, null);
      return;
    }
    if (cardId == null || cardId.length() == 0) {
      JOptionPane.showMessageDialog(this, "请输入卡号!", "警告",
                                    JOptionPane.WARNING_MESSAGE, null);
      return;
    }
    if (passwordtemp == null || passwordtemp.length() == 0) {
      JOptionPane.showMessageDialog(this, "请输入密码!", "警告",
                                    JOptionPane.WARNING_MESSAGE, null);
      return;

    }

    String dispalyNowTime = dispalyNowTimeTextField.getText() + ":00";

    WelcomePanel welcomePanel2 = new WelcomePanel();
    mainFrame.remove(mainFrame.getContentPane());
    mainFrame.getContentPane().add(welcomePanel2);
    mainFrame.setContentPane(welcomePanel2);
    mainFrame.show();
  }

  /**
   * mainFrame
   */
  private NetBarFeeMangementFrame mainFrame;
}

/**
 * UseInPanel_resetButton_actionAdapter.
 * @author
 * @version 1.0
 */
class UseInPanel_resetButton_actionAdapter
    implements java.awt.event.ActionListener {
  /**
   * adaptee
   */
  CheckInPanel adaptee;

  /**
   *
   * @param adaptee CheckInPanel
   */
  UseInPanel_resetButton_actionAdapter(CheckInPanel adaptee) {
    this.adaptee = adaptee;
  }

  /**
   *
   * @param e ActionEvent
   */
  public void actionPerformed(ActionEvent e) {
    adaptee.resetButton_actionPerformed(e);
  }
}

/**
 * UseInPanel_confirmButton_actionAdapter.
 * @author
 * @version 1.0
 */
class UseInPanel_confirmButton_actionAdapter
    implements java.awt.event.ActionListener {
  /**
   * adaptee
   */
  CheckInPanel adaptee;

  /**
   *
   * @param adaptee CheckInPanel
   */
  UseInPanel_confirmButton_actionAdapter(CheckInPanel adaptee) {
    this.adaptee = adaptee;
  }

  /**
   *
   * @param e ActionEvent
   */
  public void actionPerformed(ActionEvent e) {
    adaptee.confirmButton_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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