📄 roominfosetting.java
字号:
package RoomManagement;
import java.awt.BorderLayout;
import hotelinformationmanagesystem.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JTextArea;
import javax.swing.JTabbedPane;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
import java.sql.SQLException;
import java.sql.ResultSet;
/**
* <p>Title: 酒店信息管理系统</p>
*
* <p>Description: HotelInformationManageSystem</p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: JSP</p>
*
* @author 江世澎
* @version 1.0
*/
public class RoomInfoSetting extends JFrame {
JPanel jPRoomID = new JPanel();
XYLayout xYLayout1 = new XYLayout();
XYLayout xYLayout2 = new XYLayout();
JLabel jLRoomID = new JLabel();
JTextField jTFGetRoomID = new JTextField();
JLabel jLRoomClass = new JLabel();
JComboBox jCBRoomClass = new JComboBox();
JPanel jPPri = new JPanel();
XYLayout xYLayout3 = new XYLayout();
JLabel jLStandardPri = new JLabel();
JTextField jTFStandardPri = new JTextField();
JLabel jLRebatePri = new JLabel();
JTextField jTFRebatePri = new JTextField();
JPanel jPRoomInfo01 = new JPanel();
XYLayout xYLayout4 = new XYLayout();
JLabel jLRoomArea = new JLabel();
JTextField jTFRoomArea = new JTextField();
JLabel jLBedNo = new JLabel();
JTextField jTFBedNo = new JTextField();
JLabel jLPlace = new JLabel();
JPanel jPRoomInfo02 = new JPanel();
XYLayout xYLayout5 = new XYLayout();
JLabel jLRoomIntro = new JLabel();
JLabel jLRemark = new JLabel();
JScrollPane jSPRemark = new JScrollPane();
JScrollPane jSPRoomIntro = new JScrollPane();
JScrollPane jSPPlace = new JScrollPane();
JPanel jPRoomClass = new JPanel();
XYLayout xYLayout7 = new XYLayout();
JPanel jPEdit = new JPanel();
JButton jBEditFinish = new JButton();
JPanel jPDelete = new JPanel();
JButton jBDelete = new JButton();
JTextArea jTAPlace = new JTextArea();
JPanel jPSetRoomState = new JPanel();
JButton jBSetRoomState = new JButton();
XYLayout xYLayout8 = new XYLayout();
JPanel jPQuit = new JPanel();
JButton jBQuit = new JButton();
XYLayout xYLayout9 = new XYLayout();
JPanel jPjBNewBuild = new JPanel();
JButton jBNewBuild = new JButton();
XYLayout xYLayout10 = new XYLayout();
XYLayout xYLayout11 = new XYLayout();
XYLayout xYLayout12 = new XYLayout();
JPanel jPQueryRoomID = new JPanel();
JButton jBQueryRoomID = new JButton();
JLabel jLQueryRoomID = new JLabel();
JTextField jTFQueryRoomID = new JTextField();
XYLayout xYLayout13 = new XYLayout();
JButton jBEdit = new JButton();
JButton jBNewBuildFinish = new JButton();
JTextArea jTARoomIntro = new JTextArea();
JTextArea jTARemark = new JTextArea();
JButton jBValRoomID = new JButton();
DataConnect Connect1 = new DataConnect();
DataConnect Connect2 = new DataConnect();
ResultSet rs1l = null;
String strSearchRoomID = null;
hotelinformationmanagesystem.JudgeValidity judgeval = new JudgeValidity();
RoomStateSetting roomstatesetting = new RoomStateSetting();
public RoomInfoSetting() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(xYLayout1);
this.setSize(516, 398); //设置窗口大小(宽,高)
this.setTitle("酒店客房信息管理界面");
SetFormCenter wcenter = new SetFormCenter();
wcenter.setcenter(this);
xYLayout1.setWidth(511);
xYLayout1.setHeight(367);
this.setResizable(false);
jPRoomID.setBorder(BorderFactory.createEtchedBorder());
jPRoomID.setLayout(xYLayout2);
jLRoomClass.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLRoomClass.setText("房间类型");
jPPri.setBorder(BorderFactory.createEtchedBorder());
jPPri.setLayout(xYLayout3);
jLStandardPri.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLStandardPri.setText("标准价");
jLRebatePri.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLRebatePri.setText("折扣价");
jPRoomInfo01.setLayout(xYLayout4);
jPRoomInfo01.setBorder(BorderFactory.createEtchedBorder());
jLRoomArea.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLRoomArea.setText("客房面积");
jLBedNo.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLBedNo.setText("床位配置");
jLPlace.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLPlace.setText("具体位置");
jPRoomInfo02.setLayout(xYLayout5);
jPRoomInfo02.setBorder(BorderFactory.createEtchedBorder());
jLRoomIntro.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLRoomIntro.setText("房间介绍");
jLRemark.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLRemark.setText("备注");
jPRoomClass.setBorder(BorderFactory.createEtchedBorder());
jPRoomClass.setLayout(xYLayout7);
jPEdit.setBorder(BorderFactory.createEtchedBorder());
jPEdit.setLayout(xYLayout11);
jBEditFinish.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
jBEditFinish.setText("完成");
jBEditFinish.addActionListener(new
RoomInfoSetting_jBEditFinish_actionAdapter(this));
jPDelete.setBorder(BorderFactory.createEtchedBorder());
jPDelete.setLayout(xYLayout12);
jBDelete.setEnabled(false);
jBDelete.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
jBDelete.setText("删除");
jBDelete.addActionListener(new RoomInfoSetting_jBDelete_actionAdapter(this));
jPSetRoomState.setBorder(BorderFactory.createEtchedBorder());
jPSetRoomState.setLayout(xYLayout8);
jBSetRoomState.setEnabled(false);
jBSetRoomState.setFont(new java.awt.Font("宋体", Font.BOLD, 12));
jBSetRoomState.setText("设置房态");
jBSetRoomState.addActionListener(new
RoomInfoSetting_jBSetRoomState_actionAdapter(this));
jPQuit.setBorder(BorderFactory.createEtchedBorder());
jPQuit.setLayout(xYLayout9);
jBQuit.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jBQuit.setText("退出");
jBQuit.addActionListener(new RoomInfoSetting_jBQuit_actionAdapter(this));
jPjBNewBuild.setBorder(BorderFactory.createEtchedBorder());
jPjBNewBuild.setLayout(xYLayout10);
jBNewBuild.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
jBNewBuild.setText("新建");
jBNewBuild.addActionListener(new
RoomInfoSetting_jBNewBuild_actionAdapter(this));
jPQueryRoomID.setBorder(BorderFactory.createEtchedBorder());
jPQueryRoomID.setLayout(xYLayout13);
jBQueryRoomID.setFont(new java.awt.Font("宋体", Font.BOLD, 12));
jBQueryRoomID.setText("查找");
jBQueryRoomID.addActionListener(new
RoomInfoSetting_jBQueryRoomID_actionAdapter(this));
jLQueryRoomID.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLQueryRoomID.setText("客房ID号");
jBEdit.setEnabled(false);
jBEdit.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
jBEdit.setText("修改");
jBEdit.addActionListener(new RoomInfoSetting_jBEdit_actionAdapter(this));
jBNewBuildFinish.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
jBNewBuildFinish.setSelectedIcon(null);
jBNewBuildFinish.setText("完成");
jBNewBuildFinish.addActionListener(new
RoomInfoSetting_jBNewBuildFinish_actionAdapter(this));
jCBRoomClass.setEnabled(false);
jTFStandardPri.setEnabled(false);
jTFRebatePri.setEnabled(false);
jTARoomIntro.setEnabled(false);
jTARemark.setEnabled(false);
jTFRoomArea.setEnabled(false);
jTFBedNo.setEnabled(false);
jTAPlace.setEnabled(false);
jTFGetRoomID.setEnabled(false);
jBValRoomID.setEnabled(false);
jBValRoomID.setFont(new java.awt.Font("宋体", Font.PLAIN, 8));
jBValRoomID.setText("验证");
jBValRoomID.addActionListener(new
RoomInfoSetting_jBValRoomID_actionAdapter(this));
jPPri.add(jLStandardPri, new XYConstraints(6, 5, -1, -1));
jPRoomInfo01.add(jLRoomArea, new XYConstraints(5, 11, -1, -1));
jPRoomInfo01.add(jLBedNo, new XYConstraints(5, 42, -1, -1));
jPRoomInfo01.add(jLPlace, new XYConstraints(5, 78, -1, -1));
jPRoomInfo01.add(jSPPlace, new XYConstraints(78, 75, 115, 45));
jSPPlace.getViewport().add(jTAPlace);
jPRoomInfo02.add(jLRoomIntro, new XYConstraints(5, 3, -1, -1));
jPRoomID.add(jLRoomID, new XYConstraints(6, 8, -1, -1));
jPPri.add(jTFStandardPri, new XYConstraints(83, 3, 108, -1));
jPPri.add(jTFRebatePri, new XYConstraints(83, 31, 108, -1));
this.getContentPane().add(jPRoomInfo01,
new XYConstraints(205, 4, 202, 130));
jPRoomClass.add(jCBRoomClass, new XYConstraints(83, 3, 108, 20));
this.getContentPane().add(jPPri, new XYConstraints(4, 77, 199, 57));
this.getContentPane().add(jPRoomClass, new XYConstraints(4, 43, 199, 31));
this.getContentPane().add(jPRoomID, new XYConstraints(4, 4, 199, 37));
jPPri.add(jLRebatePri, new XYConstraints(6, 30, -1, -1));
jPRoomClass.add(jLRoomClass, new XYConstraints(6, 4, 64, -1));
jPRoomInfo01.add(jTFBedNo, new XYConstraints(78, 39, 115, -1));
jPRoomInfo01.add(jTFRoomArea, new XYConstraints(78, 9, 115, -1));
jPQueryRoomID.add(jLQueryRoomID, new XYConstraints(14, 5, -1, -1));
jPQueryRoomID.add(jTFQueryRoomID, new XYConstraints(4, 23, 82, 24));
jPRoomInfo02.add(jSPRoomIntro, new XYConstraints(14, 29, 379, 76));
jSPRoomIntro.getViewport().add(jTARoomIntro);
jPRoomInfo02.add(jLRemark, new XYConstraints(6, 108, -1, -1));
jPEdit.add(jBEdit, new XYConstraints(7, 0, 85, 32));
jPEdit.add(jBEditFinish, new XYConstraints(7, 37, 85, 32));
this.getContentPane().add(jPDelete, new XYConstraints(408, 238, 100, 39));
jPDelete.add(jBDelete, new XYConstraints(7, 1, 85, 32));
this.getContentPane().add(jPQuit, new XYConstraints(408, 322, 100, 41));
jPQuit.add(jBQuit, new XYConstraints(7, 2, 85, 32));
jPRoomInfo02.add(jSPRemark, new XYConstraints(14, 126, 379, 94));
jSPRemark.getViewport().add(jTARemark);
this.getContentPane().add(jPRoomInfo02,
new XYConstraints(5, 136, 402, 227));
jPjBNewBuild.add(jBNewBuild, new XYConstraints(7, 0, 85, 32));
jPjBNewBuild.add(jBNewBuildFinish, new XYConstraints(7, 35, 85, 32));
jPRoomID.add(jTFGetRoomID, new XYConstraints(83, 4, 55, 25));
jPRoomID.add(jBValRoomID, new XYConstraints(141, 7, -1, -1));
this.getContentPane().add(jPSetRoomState,
new XYConstraints(408, 279, 100, 41));
jPSetRoomState.add(jBSetRoomState, new XYConstraints(7, 2, -1, 32));
this.getContentPane().add(jPEdit, new XYConstraints(408, 163, 100, 75));
this.getContentPane().add(jPjBNewBuild,
new XYConstraints(408, 88, 100, 74));
this.getContentPane().add(jPQueryRoomID,
new XYConstraints(408, 4, 100, 83));
jPQueryRoomID.add(jBQueryRoomID, new XYConstraints(13, 52, 69, -1));
jLRoomID.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
jLRoomID.setText("客房ID号");
jBEditFinish.setEnabled(false);
jBNewBuildFinish.setEnabled(false);
}
public void jBQuit_actionPerformed(ActionEvent e) { //退出
this.setVisible(false);
}
public void jBSetRoomState_actionPerformed(ActionEvent e) { //设置房态
jBSetRoomState.setEnabled(false);
roomstatesetting.jTFStateSetRoomID.setText(strSearchRoomID);
roomstatesetting.setVisible(true);
}
public void jBNewBuild_actionPerformed(ActionEvent e) { //新建
jTFGetRoomID.setEnabled(true);
jTFGetRoomID.setText("");
jBValRoomID.setEnabled(true);
jCBRoomClass.removeAllItems();
jCBRoomClass.addItem(" ");
jCBRoomClass.addItem("标准单人间");
jCBRoomClass.addItem("标准双人间");
jCBRoomClass.addItem("标准四人间");
jCBRoomClass.addItem("家庭间");
jCBRoomClass.addItem("商务间");
jCBRoomClass.addItem("经济间");
jCBRoomClass.addItem("豪华套房");
jTFStandardPri.setText("");
jTFRebatePri.setText("");
jTFRoomArea.setText("");
jTFBedNo.setText("");
jTAPlace.setText("");
jTARoomIntro.setText("");
jTARemark.setText("");
jBNewBuild.setEnabled(false);
jTFQueryRoomID.setEnabled(false);
jBQueryRoomID.setEnabled(false);
jBEdit.setEnabled(false);
jBDelete.setEnabled(false);
}
public void jBValRoomID_actionPerformed(ActionEvent e) { //验证
String strRoomifID = jTFGetRoomID.getText();
if (strRoomifID.equals("")) {
JOptionPane.showMessageDialog(null,
"客房ID不能为空,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -