📄 roomstatesetting.java~19~
字号:
package RoomManagement;
import java.awt.BorderLayout;
import hotelinformationmanagesystem.*;
import javax.swing.JFrame;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.JFormattedTextField;
import javax.swing.JEditorPane;
import javax.swing.border.EtchedBorder;
import java.awt.Color;
import javax.swing.border.Border;
import javax.swing.JScrollPane;
import java.sql.ResultSet;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* <p>Title: 酒店信息管理系统</p>
*
* <p>Description: HotelInformationManageSystem</p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: JSP</p>
*
* @author 江世澎
* @version 1.0
*/
public class RoomStateSetting extends JFrame {
XYLayout xYLayout1 = new XYLayout();
JPanel jPRoomID = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JLabel jLRoomID = new JLabel();
JTextField jTFStateSetRoomID = new JTextField();
JButton jBQueryRoomID = new JButton();
JPanel jPReason = new JPanel();
XYLayout xYLayout3 = new XYLayout();
JLabel jLReason = new JLabel();
JPanel jPDate = new JPanel();
XYLayout xYLayout4 = new XYLayout();
JLabel jLStartDate = new JLabel();
JTextField jTFStartDate = new JTextField();
JLabel jLEndDate = new JLabel();
JTextField jTFEndDate = new JTextField();
JPanel jPQurey = new JPanel();
XYLayout xYLayout5 = new XYLayout();
JPanel jPCommand01 = new JPanel();
Border border1 = BorderFactory.createEtchedBorder(EtchedBorder.RAISED,
Color.white, new Color(165, 163, 151));
XYLayout xYLayout6 = new XYLayout();
JButton jBSetDirtyRoom = new JButton();
JButton jBSetCleanRoom = new JButton();
JButton jBSetDadRoom = new JButton();
JButton jBSetGoodRoom = new JButton();
JButton jBQuit = new JButton();
JButton jBSetMaintain = new JButton();
JButton jBSetDismaintain = new JButton();
JPanel jPCommand03 = new JPanel();
XYLayout xYLayout7 = new XYLayout();
JButton jBSave = new JButton();
JButton jBSetDestine = new JButton();
JPanel jPCommand02 = new JPanel();
XYLayout xYLayout8 = new XYLayout();
JButton jBSetDisDestine = new JButton();
JScrollPane jSPReason = new JScrollPane();
JTextArea jTAReason = new JTextArea();
JButton jBSetCOUT = new JButton();
JButton jBSetCON = new JButton();
hotelinformationmanagesystem.JudgeValidity judgeval = new JudgeValidity();
DataConnect Connect1 = new DataConnect();
ResultSet rs1l = null;
public static String strHowOnUser = null;
public RoomStateSetting() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(xYLayout1);
this.setResizable(false);
this.setSize(410, 350); //设置窗口初始位置(,,,宽,高)
SetFormCenter wcenter = new SetFormCenter();
wcenter.setcenter(this);
this.setTitle("客房状态设置");
jPRoomID.setBorder(BorderFactory.createEtchedBorder());
jPRoomID.setToolTipText("");
jPRoomID.setLayout(xYLayout2);
xYLayout1.setWidth(405);
xYLayout1.setHeight(317);
jBQueryRoomID.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
jBQueryRoomID.setText("查找");
jBQueryRoomID.addActionListener(new
RoomStateSetting_jBQueryRoomID_actionAdapter(this));
jPReason.setBorder(BorderFactory.createEtchedBorder());
jPReason.setToolTipText("");
jPReason.setLayout(xYLayout3);
jLReason.setFont(new java.awt.Font("宋体", Font.BOLD, 20));
jLReason.setText("原因");
jPDate.setLayout(xYLayout4);
jPDate.setBorder(BorderFactory.createEtchedBorder());
jLStartDate.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jLStartDate.setText("开始日期");
jLEndDate.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jLEndDate.setText("结束日期");
jPQurey.setLayout(xYLayout5);
jPQurey.setBorder(BorderFactory.createEtchedBorder());
jPCommand01.setBorder(border1);
jPCommand01.setLayout(xYLayout6);
jBSetDirtyRoom.setText("置脏房");
jBSetDirtyRoom.addActionListener(new
RoomStateSetting_jBSetDirtyRoom_actionAdapter(this));
jBSetCleanRoom.setText("置净房");
jBSetCleanRoom.addActionListener(new
RoomStateSetting_jBSetCleanRoom_actionAdapter(this));
jBSetDadRoom.setToolTipText("");
jBSetDadRoom.setText("置坏房");
jBSetDadRoom.addActionListener(new
RoomStateSetting_jBSetDadRoom_actionAdapter(this));
jBSetGoodRoom.setToolTipText("");
jBSetGoodRoom.setText("消坏房");
jBSetGoodRoom.addActionListener(new
RoomStateSetting_jBSetGoodRoom_actionAdapter(this));
jBQuit.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jBQuit.setText("退出");
jBQuit.addActionListener(new RoomStateSetting_jBQuit_actionAdapter(this));
jBSetMaintain.setText("置维修");
jBSetMaintain.addActionListener(new
RoomStateSetting_jBSetMaintain_actionAdapter(this));
jBSetDismaintain.setText("消维修");
jBSetDismaintain.addActionListener(new
RoomStateSetting_jBSetDismaintain_actionAdapter(this));
jPCommand03.setBorder(BorderFactory.createEtchedBorder());
jPCommand03.setLayout(xYLayout7);
jBSave.setEnabled(false);
jBSave.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jBSave.setText("保存");
jBSave.addActionListener(new RoomStateSetting_jBSave_actionAdapter(this));
jBSetDestine.setText("置预订");
jBSetDestine.addActionListener(new
RoomStateSetting_jBSetDestine_actionAdapter(this));
jPCommand02.setBorder(BorderFactory.createEtchedBorder());
jPCommand02.setLayout(xYLayout8);
jBSetDisDestine.setText("消预订");
jBSetDisDestine.addActionListener(new
RoomStateSetting_jBSetDisDestine_actionAdapter(this));
jBSetCOUT.setText("置退房");
jBSetCOUT.addActionListener(new
RoomStateSetting_jBSetCOUT_actionAdapter(this));
jBSetCON.setText("置入住");
jBSetCON.addActionListener(new RoomStateSetting_jBSetCON_actionAdapter(this));
jPRoomID.add(jLRoomID, new XYConstraints(7, 6, -1, -1));
jPDate.add(jLStartDate, new XYConstraints(7, 7, -1, -1));
jPDate.add(jLEndDate, new XYConstraints(7, 41, -1, -1));
jPCommand01.add(jBSetMaintain, new XYConstraints(81, 1, 74, 29));
jPCommand01.add(jBSetDadRoom, new XYConstraints(157, 1, 74, 29));
jPReason.add(jLReason, new XYConstraints(7, 1, -1, -1));
jPReason.add(jSPReason, new XYConstraints(8, 30, 379, 79));
jSPReason.getViewport().add(jTAReason);
jPCommand03.add(jBSave, new XYConstraints(5, 6, 74, 29));
jPCommand03.add(jBQuit, new XYConstraints(5, 37, 74, 29));
this.getContentPane().add(jPQurey, new XYConstraints(314, 4, 86, 40));
jPQurey.add(jBQueryRoomID, new XYConstraints(5, 3, 74, -1));
jPCommand01.add(jBSetDirtyRoom, new XYConstraints(3, 1, 74, 29));
jPCommand01.add(jBSetDismaintain, new XYConstraints(81, 33, 74, 29));
jPCommand01.add(jBSetCleanRoom, new XYConstraints(3, 33, 74, 29));
jPCommand01.add(jBSetGoodRoom, new XYConstraints(157, 33, 74, 29));
jPCommand02.add(jBSetCON, new XYConstraints(0, 0, 75, 29));
jPCommand02.add(jBSetCOUT, new XYConstraints(1, 32, 74, 29));
jPCommand02.add(jBSetDestine, new XYConstraints(76, 0, 74, 29));
jPCommand02.add(jBSetDisDestine, new XYConstraints(76, 32, 74, 29));
this.getContentPane().add(jPCommand03,
new XYConstraints(314, 47, 86, 76));
this.getContentPane().add(jPReason, new XYConstraints(5, 124, 395, 117));
this.getContentPane().add(jPCommand02,
new XYConstraints(244, 243, 156, 68));
this.getContentPane().add(jPCommand01,
new XYConstraints(5, 242, 237, 69));
jPRoomID.add(jTFStateSetRoomID, new XYConstraints(82, 3, 212, 29));
jPDate.add(jTFStartDate, new XYConstraints(82, 4, 213, 23));
jPDate.add(jTFEndDate, new XYConstraints(82, 37, 213, 23));
this.getContentPane().add(jPRoomID, new XYConstraints(5, 4, 305, 40));
this.getContentPane().add(jPDate, new XYConstraints(5, 47, 305, 76));
jLRoomID.setFont(new java.awt.Font("宋体", Font.BOLD, 20));
jLRoomID.setText("客房号");
jBSetDirtyRoom.setEnabled(false); //置脏房
jBSetCleanRoom.setEnabled(false); //置净房
jBSetMaintain.setEnabled(false); //置维修
jBSetDismaintain.setEnabled(false); //消维修
jBSetDadRoom.setEnabled(false); //置坏房
jBSetGoodRoom.setEnabled(false); //消坏房
jBSetDestine.setEnabled(false); //置预定
jBSetDisDestine.setEnabled(false); //消预定
jBSetCOUT.setEnabled(false); //置退房
jBSetCON.setEnabled(false); //置入住
jTAReason.setEnabled(false);
jTFStartDate.setEnabled(false);
jTFEndDate.setEnabled(false);
}
public void jBQueryRoomID_actionPerformed(ActionEvent e) { //查找
String strRoomifID = jTFStateSetRoomID.getText();
jTAReason.setEnabled(true);
jTFStartDate.setEnabled(true);
jTFEndDate.setEnabled(true);
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
try {
//-----------------------------------------------------------------------------------------------------
Connect1 = new DataConnect();
Connect1.con1 = DriverManager.getConnection(Connect1.url); //建立连接
Connect1.stmt1 = Connect1.con1.createStatement(); //创建语句
Connect1.sql1 = "SELECT * FROM HIMS_RoomState";
rs1l = Connect1.stmt1.executeQuery(Connect1.sql1);
//-----------------------------------------------------------------------------------------------------
while (rs1l.next()) {
String strRoomID = rs1l.getString("RoomID");
String strOnUser = rs1l.getString("OnUser");
String strReason = rs1l.getString("Reason");
Date strStartDate = rs1l.getDate("StartDate");
Date strEndDate = rs1l.getDate("EndDate");
if (strRoomID.equals(strRoomifID)) {
jBSave.setEnabled(true);
jBQueryRoomID.setEnabled(false);
jTFStateSetRoomID.setEnabled(false);
jTFStateSetRoomID.setText(strRoomID);
try {
jTFStartDate.setText(dateformat.format(strStartDate));
} catch (Exception ex) {
jTFStartDate.setText("2000-01-01");
}
try {
jTFEndDate.setText(dateformat.format(strEndDate));
} catch (Exception ex) {
jTFEndDate.setText("2000-01-01");
}
jTAReason.setText(strReason);
if (strOnUser.equals("1")) { //置入住
jBSetDirtyRoom.setEnabled(true); //置脏房
jBSetCleanRoom.setEnabled(false); //置净房
jBSetMaintain.setEnabled(true); //置维修
jBSetDismaintain.setEnabled(false); //消维修
jBSetDadRoom.setEnabled(true); //置坏房
jBSetGoodRoom.setEnabled(false); //消坏房
jBSetDestine.setEnabled(false); //置预定
jBSetDisDestine.setEnabled(false); //消预定
jBSetCOUT.setEnabled(true); //置退房
jBSetCON.setEnabled(false); //置入住
strHowOnUser = "1";
}
if (strOnUser.equals("2")) { //置退房
jBSetDirtyRoom.setEnabled(false); //置脏房
jBSetCleanRoom.setEnabled(false); //置净房
jBSetMaintain.setEnabled(false); //置维修
jBSetDismaintain.setEnabled(false); //消维修
jBSetDadRoom.setEnabled(false); //置坏房
jBSetGoodRoom.setEnabled(false); //消坏房
jBSetDestine.setEnabled(true); //置预定
jBSetDisDestine.setEnabled(false); //消预定
jBSetCOUT.setEnabled(false); //置退房
jBSetCON.setEnabled(true); //置入住
strHowOnUser = "2";
}
if (strOnUser.equals("3")) { //置预定
jBSetDirtyRoom.setEnabled(false); //置脏房
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -