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

📄 checkinpanel.java~35~

📁 一个java+sql2000开发的网吧管理系统
💻 JAVA~35~
字号:
package com.jbaptech.accp.netbar.client;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.text.*;
import java.util.*;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;


/**
 * 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 {
  JLabel computerIdDescLabel = new JLabel();
  JLabel cardIdDescLabel = new JLabel();
  static JTextField cardIdTextField = new JTextField();
  JLabel pwdDescLabel = new JLabel();
  JLabel dispalyNowTimeDescLabel = new JLabel();
  static JTextField dispalyNowTimeTextField = new JTextField();
  JButton confirmButton = new JButton();
  JButton resetButton = new JButton();
  static JPasswordField passwordFiled = new JPasswordField();
  static JComboBox computerIdCombox = new JComboBox();
  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);

    BusinessAction businessAction = new BusinessAction();
    businessAction.getNotUsedComputeList();


  }



  //重置按钮的点击事件

  void resetButton_actionPerformed(ActionEvent e) {
   //重置
    computerIdCombox.setSelectedIndex(0);
    cardIdTextField.setText("");
    passwordFiled.setText("");
    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);

  }

  //确定按钮的点击事件

  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;
    }
    else{
      StartUse start = new StartUse();
      String ComputerId = computerIdCombox.getSelectedItem().toString();
      String CardId = cardIdTextField.getText();
      String Password = passwordFiled.getSelectedText();
      String BeginTime = dispalyNowTimeTextField.getText();
      start.doStartUseComputerBusiness(CardId,ComputerId,BeginTime);

    }



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

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

  private NetBarFeeMangementFrame mainFrame;

}


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

  UseInPanel_resetButton_actionAdapter(CheckInPanel adaptee) {
    this.adaptee = adaptee;
  }

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

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

  UseInPanel_confirmButton_actionAdapter(CheckInPanel adaptee) {
    this.adaptee = adaptee;
  }

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

⌨️ 快捷键说明

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