📄 systeminfomenu.java~16~
字号:
package InfoQueryList;
import java.awt.*;
import ShowTable.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import hotelinformationmanagesystem.SetFormCenter;
import javax.swing.BorderFactory;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p>Title: 酒店信息管理系统</p>
*
* <p>Description: The Management Information System of Hotel</p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: JSP</p>
*
* @author 江世澎
* @version 1.0
*/
public class SystemInfoMenu extends JFrame {
XYLayout xYLayout1 = new XYLayout();
JTable jTable1;
TableExample table = new TableExample();
JTable jTable2;
TableExample table2 = new TableExample();
JScrollPane jSPShowInfo = new JScrollPane();
JPanel jPanel1 = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JRadioButton jRBShowEmpAccounts = new JRadioButton();
JRadioButton jRBShowEmpRegister = new JRadioButton();
ButtonGroup BGEmpInfo = new ButtonGroup();
JButton jBQuery = new JButton();
JButton jButton1 = new JButton();
JPanel jPanel2 = new JPanel();
XYLayout xYLayout3 = new XYLayout();
JLabel jLEmpID = new JLabel();
JTextField jTFEmpID = new JTextField();
JScrollPane jSPAccounts = new JScrollPane();
JLabel jLEmpInfo = new JLabel();
JLabel jLabel1 = new JLabel();
public SystemInfoMenu() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(xYLayout1);
this.setSize(425, 370); //宽,高
this.setResizable(false);
this.setTitle("系统内部信息查询");
SetFormCenter wcenter = new SetFormCenter();
wcenter.setcenter(this);
jTable1 = table.createTable();
jTable2 = table2.createTable();
jSPShowInfo.setBorder(BorderFactory.createEtchedBorder());
jRBShowEmpAccounts.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jRBShowEmpAccounts.setActionCommand("查看为客户登记和修改信息的员工信息");
jRBShowEmpRegister.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jPanel1.setToolTipText("本选项只能对最后一次操作的员工信息进行查询");
xYLayout1.setWidth(421);
xYLayout1.setHeight(336);
jBQuery.setText("查询");
jBQuery.addActionListener(new SystemInfoMenu_jBQuery_actionAdapter(this));
jButton1.setText("退出");
jButton1.addActionListener(new SystemInfoMenu_jButton1_actionAdapter(this));
jPanel2.setBorder(BorderFactory.createEtchedBorder());
jPanel2.setLayout(xYLayout3);
jLEmpID.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jLEmpID.setText("员工ID号");
jTFEmpID.setBorder(BorderFactory.createEtchedBorder());
jRBShowEmpAccounts.setText("查看为客户登记和修改信息的员工信息");
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setLayout(xYLayout2);
jRBShowEmpRegister.setText("查看为客户结账的员工信息");
jSPAccounts.setBorder(BorderFactory.createEtchedBorder());
jLEmpInfo.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jLEmpInfo.setText("员工信息");
jLabel1.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jLabel1.setText("所做的操作");
BGEmpInfo.add(jRBShowEmpAccounts);
BGEmpInfo.add(jRBShowEmpRegister);
jPanel1.add(jRBShowEmpRegister, new XYConstraints(9, 6, -1, -1));
jPanel1.add(jRBShowEmpAccounts, new XYConstraints(9, 37, -1, -1));
this.getContentPane().add(jLEmpInfo, new XYConstraints(3, 2, -1, -1));
this.getContentPane().add(jSPShowInfo,
new XYConstraints(1, 20, 212, 202));
jSPAccounts.getViewport().add(jTable2);
jSPShowInfo.getViewport().add(jTable1);
jPanel2.add(jLEmpID, new XYConstraints(3, 8, -1, -1));
jPanel2.add(jTFEmpID, new XYConstraints(78, 1, 132, 30));
this.getContentPane().add(jPanel1, new XYConstraints(1, 263, 318, -1));
this.getContentPane().add(jPanel2, new XYConstraints(1, 223, 216, 38));
this.getContentPane().add(jSPAccounts,
new XYConstraints(216, 20, 198, 202));
this.getContentPane().add(jLabel1, new XYConstraints(217, 2, -1, -1));
this.getContentPane().add(jButton1, new XYConstraints(333, 299, 81, 32));
this.getContentPane().add(jBQuery, new XYConstraints(333, 224, 81, 32));
}
public void jButton1_actionPerformed(ActionEvent e) {
this.setVisible(false);
}
public void jBQuery_actionPerformed(ActionEvent e) {
String strEmpID = jTFEmpID.getText();
if (BGEmpInfo.getSelection() == jRBShowEmpAccounts.getModel()) { //查看为客户结账的员工信息
table.fetch("select EmpID as 员工ID,Name as 姓名,IDCard as 身份证号,Department as 部门,Duty as 职务 from HIMS_Employee Where EmpID like '" +
strEmpID + "';");
table2.fetch("select Name as 姓名, Company as 单位,CheckInDate as 入住日期,QuitDate as 离店日期,Reckoning as 金额 from HIMS_Register,HIMS_Register_Account Where EmpID like '" +
strEmpID + "' AND HIMS_Register.DutyID = HIMS_Register_Account.DutyID;");
if (jTable1.getRowCount() == 0) {
JOptionPane.showMessageDialog(null,
"您所要查找的数据不在数据库中!!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFEmpID.setText("");
}
return;
}
if (BGEmpInfo.getSelection() == jRBShowEmpRegister.getModel()) { //查看为客户登记和修改信息的员工信息
table.fetch("select EmpID as 员工ID,Name as 姓名,IDCard as 身份证号,Department as 部门,Duty as 职务 from HIMS_Employee Where EmpID like '" +
strEmpID +
"';");
table2.fetch("select Name as 姓名, Company as 单位,CheckInDate as 入住日期,QuitDate as 离店日期 from HIMS_Register Where EmpID like '" +
strEmpID + "' ;");
if (jTable1.getRowCount() == 0) {
JOptionPane.showMessageDialog(null,
"您所要查找的数据不在数据库中!!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFEmpID.setText("");
}
return;
}
}
}
class SystemInfoMenu_jBQuery_actionAdapter implements ActionListener {
private SystemInfoMenu adaptee;
SystemInfoMenu_jBQuery_actionAdapter(SystemInfoMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBQuery_actionPerformed(e);
}
}
class SystemInfoMenu_jButton1_actionAdapter implements ActionListener {
private SystemInfoMenu adaptee;
SystemInfoMenu_jButton1_actionAdapter(SystemInfoMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -