网吧计费系统
源代码在线查看: checkoutdialog.java~5~
package com.jbaptech.accp.netbar.client;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.text.*;
import com.jbaptech.accp.netbar.server.action.BusinessAction;
import java.util.ArrayList;
import com.jbaptech.accp.netbar.server.entity.Record;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2003
* Company:
* @author not attributable
* @version 1.0
*/
public class CheckOutDialog extends JDialog {
JPanel panel1 = new JPanel();
BorderLayout borderLayout1 = new BorderLayout();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jTextField2 = new JTextField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JComboBox computerIdCombox = new JComboBox();
java.util.Date nowTime;
public CheckOutDialog(NetBarFeeMangementFrame frame, String title, boolean modal) {
super(frame, title, modal);
mainFrame = frame;
this.setLocation(250,200);
try {
jbInit();
pack();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public CheckOutDialog() {
this(null, "", false);
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(borderLayout1);
panel1.setPreferredSize(new Dimension(300, 200));
panel1.setLayout(null);
jLabel1.setFont(new java.awt.Font("Serif", 0, 16));
jLabel1.setText("机 器 号:");
jLabel1.setBounds(new Rectangle(50, 30, 80, 25));
computerIdCombox.setBounds(new Rectangle(130, 30, 100, 25));
jLabel2.setFont(new java.awt.Font("Serif", 0, 16));
jLabel2.setText("结束时间:");
jLabel2.setBounds(new Rectangle(50, 100, 80, 25));
nowTime = new java.util.Date();
SimpleDateFormat HMFromat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String strNowTime = HMFromat.format(nowTime);
jTextField2.setText(strNowTime);
jTextField2.setBounds(new Rectangle(130, 100, 100, 25));
jButton1.setBounds(new Rectangle(60, 150, 70, 25));
jButton1.setText("确定");
jButton1.addActionListener(new useOutDialog_jButton1_actionAdapter(this));
jButton2.setBounds(new Rectangle(150, 150, 70, 25));
jButton2.setText("重置");
jButton2.addActionListener(new useOutDialog_jButton2_actionAdapter(this));
panel1.add(jLabel1, null);
panel1.add(jLabel2, null);
panel1.add(jTextField2, null);
panel1.add(jButton1, null);
panel1.add(jButton2, null);
panel1.add(computerIdCombox, null);
this.getContentPane().add(panel1, BorderLayout.CENTER);
ArrayList list =BusinessAction.getNotStopComputer();
for(int i=0;i Record computer = (Record) list.get(i);
computerIdCombox.addItem(computer.getComputerId());
}
}
void jButton2_actionPerformed(ActionEvent e) {
computerIdCombox.setSelectedIndex(0);
jTextField2.setText("");
}
void jButton1_actionPerformed(ActionEvent e) {
String stopTime = jTextField2.getText()+":00";
String computerId = computerIdCombox.getSelectedItem().toString().trim();
if(computerId ==null || computerId.length()==0){
return;
}
Record record = new Record();
record.setComputerId(computerId);
record.setEndTime(stopTime);
ComsumeDisplayData data =BusinessAction.doStopUseComputerBusiness(record);
mainFrame.consumeDisplayData = data;
this.hide();
}
private NetBarFeeMangementFrame mainFrame;
}
class useOutDialog_jButton2_actionAdapter implements java.awt.event.ActionListener {
CheckOutDialog adaptee;
useOutDialog_jButton2_actionAdapter(CheckOutDialog adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class useOutDialog_jButton1_actionAdapter implements java.awt.event.ActionListener {
CheckOutDialog adaptee;
useOutDialog_jButton1_actionAdapter(CheckOutDialog adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}