package view;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import model.dao.*;
import model.entity.Computer;
import model.entity.Record;
public class Shangji extends JPanel {
private static final Computer Computer = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JButton btnOK = null;
private JButton btnReset = null;
private JComboBox cbxComputerid = null;
private JTextField txtCardid = null;
private JPasswordField pwfPassword = null;
private JTextField txtBeginTime = null;
public MainApplication main = null;
/**
* This is the default constructor
*/
public Shangji() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
jLabel3 = new JLabel();
jLabel3.setBounds(new java.awt.Rectangle(104,240,74,30));
jLabel3.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
jLabel3.setText("开始时间:");
jLabel2 = new JLabel();
jLabel2.setBounds(new java.awt.Rectangle(104,180,74,30));
jLabel2.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
jLabel2.setText("密 码:");
jLabel1 = new JLabel();
jLabel1.setBounds(new java.awt.Rectangle(104,120,74,30));
jLabel1.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
jLabel1.setText("卡 号:");
jLabel = new JLabel();
jLabel.setBounds(new java.awt.Rectangle(104,60,74,30));
jLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
jLabel.setText("机 器 号:");
this.setLayout(null);
this.setSize(450, 320);
this.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 14));
this.add(jLabel, null);
this.add(jLabel1, null);
this.add(jLabel2, null);
this.add(jLabel3, null);
this.add(getBtnOK(), null);
this.add(getBtnReset(), null);
this.add(getCbxComputerid(), null);
this.add(getTxtCardid(), null);
this.add(getPwfPassword(), null);
this.add(getTxtBeginTime(), null);
}
/**
* This method initializes btnOK
*
* @return javax.swing.JButton
*/
private JButton getBtnOK() {
if (btnOK == null) {
btnOK = new JButton();
btnOK.setBounds(new java.awt.Rectangle(122,284,89,25));
btnOK.setText("确认");
btnOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
getShangji();
}
});
}
return btnOK;
}
void getShangji()
{
String id=this.txtCardid.getText().trim();
String password=this.pwfPassword.getText().trim();
String computerid=(cbxComputerid.getSelectedItem()+"").toString();
if(computerid==null || computerid.trim().length()==0)
{
JOptionPane.showMessageDialog(this,"请选择机器号!","警告",JOptionPane.WARNING_MESSAGE ,null );
}
if(id==null||id.length()==0)
{
JOptionPane.showMessageDialog(this,"请输入卡号!","警告",JOptionPane.WARNING_MESSAGE ,null );
}
if(password==null||password.length()==0)
{
JOptionPane.showMessageDialog(this,"请输入密码!","警告",JOptionPane.WARNING_MESSAGE ,null );
}
if(!CardDAO.cardIsValid(id,password))
{
JOptionPane.showMessageDialog(this,"卡号或者密码错误或者卡余额不足","警告",JOptionPane.WARNING_MESSAGE ,null );
}
Record record = new Record();
record.setCardid(Integer.valueOf(id));
record.setComputerid(Integer.valueOf(computerid));
record.setBeginTime(this.txtBeginTime.getText());
RecordDAO.doStartUseComputerBusiness(record);
WelcomePanel w=new WelcomePanel();
main.remove(main.getContentPane());
main.setContentPane(w);
main.show();
}
/**
* This method initializes btnReset
*
* @return javax.swing.JButton
*/
private JButton getBtnReset() {
if (btnReset == null) {
btnReset = new JButton();
btnReset.setBounds(new java.awt.Rectangle(256,284,89,25));
btnReset.setText("重置");
btnReset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
getReset();
}
});
}
return btnReset;
}
void getReset()
{
cbxComputerid.setSelectedIndex(0);
txtCardid.setText("");
pwfPassword.setText("");
txtBeginTime.setText("");
}
/**
* This method initializes cbxComputerid
*
* @return javax.swing.JComboBox
*/
private JComboBox getCbxComputerid() {
if (cbxComputerid == null) {
cbxComputerid = new JComboBox();
cbxComputerid.setBounds(new java.awt.Rectangle(209,60,211,30));
cbxComputerid.addItem("");
ArrayList list =CompterDAO.getSel();
for(int i=0;i<list.size();i++){
Computer computer = (Computer) list.get(i);
cbxComputerid.addItem(computer.getId());
}
}
return cbxComputerid;
}
/**
* This method initializes txtCardid
*
* @return javax.swing.JTextField
*/
private JTextField getTxtCardid() {
if (txtCardid == null) {
txtCardid = new JTextField();
txtCardid.setBounds(new java.awt.Rectangle(209,120,211,30));
}
return txtCardid;
}
/**
* This method initializes pwfPassword
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getPwfPassword() {
if (pwfPassword == null) {
pwfPassword = new JPasswordField();
pwfPassword.setBounds(new java.awt.Rectangle(209,180,211,30));
}
return pwfPassword;
}
/**
* This method initializes txtBeginTime
*
* @return javax.swing.JTextField
*/
private JTextField getTxtBeginTime() {
if (txtBeginTime == null) {
txtBeginTime = new JTextField();
txtBeginTime.setBounds(new java.awt.Rectangle(209,240,211,30));
txtBeginTime.setEditable(false);
java.util.Date nowTime = new java.util.Date();
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String strNowTime = sd.format(nowTime);
txtBeginTime.setText(strNowTime);
}
return txtBeginTime;
}
}
Drdong
- 粉丝: 0
- 资源: 1
最新资源
- 35 财务汇报部门历年薪酬统计图表.xlsx
- 39 财务工资发放表.xlsx
- 37 财务工资支出上半年年中总结报告.xlsx
- 38 财务分析工资年度开支表.xlsx
- 41 财务公司部门工资开支分析表.xlsx
- 40 财务分析部门工资支出图表.xlsx
- 42 部门员工工资统计表.xlsx
- 45 年度薪酬费用统计表.xlsx
- 44 人事薪酬管理台账.xlsx
- 48 工资对比分析报表模板.xls
- 47 可视化工资表自动统计1.xlsx
- 46 企业员工工资支出预算表.xlsx
- 43 工资收入对比分析表.xlsx
- 50 薪资分析图表.xlsx
- 49 薪酬数据统计分析报表excel模板.xlsx
- 年度公司薪酬调查分析方案(完整版).docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈