📄 roominfoquery.java~21~
字号:
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.JScrollPane;
import javax.swing.JButton;
import javax.swing.JTable;
import ShowTable.TableExample;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import java.awt.Font;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
/**
* <p>Title: 酒店信息管理系统</p>
*
* <p>Description: HotelInformationManageSystem</p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: JSP</p>
*
* @author 江世澎
* @version 1.0
*/
public class RoomInfoQuery extends JFrame {
JTable jTable1;
TableExample table = new TableExample();
XYLayout xYLayout1 = new XYLayout();
JScrollPane jSPShowRoomInfo = new JScrollPane();
JPanel jPCON = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JRadioButton jRBDestine = new JRadioButton();
JRadioButton jRBCON = new JRadioButton();
JRadioButton jRBBadRoom = new JRadioButton();
JPanel jPRoomClass = new JPanel();
XYLayout xYLayout3 = new XYLayout();
JRadioButton jRBRoomClass = new JRadioButton();
JComboBox jCBRoomClass = new JComboBox();
JPanel jPRoomID = new JPanel();
XYLayout xYLayout4 = new XYLayout();
JRadioButton jRBRoomID = new JRadioButton();
JTextField jTFRoomID = new JTextField();
JPanel jPBedNom = new JPanel();
XYLayout xYLayout5 = new XYLayout();
JRadioButton jRBBedNom = new JRadioButton();
JTextField jTFBedNom = new JTextField();
JPanel jPCommand = new JPanel();
XYLayout xYLayout6 = new XYLayout();
JButton jBQuery = new JButton();
JButton jBQuit = new JButton();
JPanel jPDestine = new JPanel();
XYLayout xYLayout7 = new XYLayout();
JPanel jPBadRoom = new JPanel();
XYLayout xYLayout8 = new XYLayout();
ButtonGroup BGQueryChange = new ButtonGroup();
hotelinformationmanagesystem.JudgeValidity judgeval = new JudgeValidity();
public RoomInfoQuery() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
jTable1 = table.createTable();
getContentPane().setLayout(xYLayout1);
this.setSize(420, 305);
SetFormCenter wcenter = new SetFormCenter();
wcenter.setcenter(this);
this.setTitle("酒店客房查询界面");
this.setResizable(false);
xYLayout1.setWidth(416);
xYLayout1.setHeight(277);
jRBCON.setText("按入住查询");
jRBCON.addActionListener(new RoomInfoQuery_jRBCON_actionAdapter(this));
jRBBadRoom.setText("按坏房查询");
jRBBadRoom.addActionListener(new RoomInfoQuery_jRBBadRoom_actionAdapter(this));
jPRoomClass.setLayout(xYLayout3);
jPRoomClass.setBorder(BorderFactory.createEtchedBorder());
jRBRoomClass.setText("按客房类型查询");
jRBRoomClass.addActionListener(new
RoomInfoQuery_jRBRoomClass_actionAdapter(this));
jPRoomID.setLayout(xYLayout4);
jPRoomID.setBorder(BorderFactory.createEtchedBorder());
jRBRoomID.setText("按客房ID查询");
jRBRoomID.addActionListener(new RoomInfoQuery_jRBRoomID_actionAdapter(this));
jPBedNom.setLayout(xYLayout5);
jPBedNom.setBorder(BorderFactory.createEtchedBorder());
jRBBedNom.setText("按客房床位数查询");
jRBBedNom.addActionListener(new RoomInfoQuery_jRBBedNom_actionAdapter(this));
jPCommand.setLayout(xYLayout6);
jPCommand.setBorder(BorderFactory.createEtchedBorder());
jBQuery.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jBQuery.setText("查询");
jBQuery.addActionListener(new RoomInfoQuery_jBQuery_actionAdapter(this));
jBQuit.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jBQuit.setText("退出");
jBQuit.addActionListener(new RoomInfoQuery_jBQuit_actionAdapter(this));
jPDestine.setLayout(xYLayout7);
jPDestine.setBorder(BorderFactory.createEtchedBorder());
jPBadRoom.setBorder(BorderFactory.createEtchedBorder());
jPBadRoom.setLayout(xYLayout8);
jRBDestine.addActionListener(new RoomInfoQuery_jRBDestine_actionAdapter(this));
jPBedNom.add(jRBBedNom, new XYConstraints(5, 3, -1, -1));
jPBedNom.add(jTFBedNom, new XYConstraints(147, 3, 63, 23));
this.getContentPane().add(jPBadRoom, new XYConstraints(2, 237, 100, 35));
jPBadRoom.add(jRBBadRoom, new XYConstraints(2, 3, -1, -1));
jPRoomID.add(jRBRoomID, new XYConstraints(5, 4, -1, -1));
jPRoomID.add(jTFRoomID, new XYConstraints(123, 5, 87, 23));
jPRoomClass.add(jRBRoomClass, new XYConstraints(5, 4, -1, -1));
jPRoomClass.add(jCBRoomClass, new XYConstraints(131, 3, 79, -1));
jPCommand.add(jBQuit, new XYConstraints(2, 58, 73, 42));
jPCommand.add(jBQuery, new XYConstraints(3, 6, 73, 42));
jRBDestine.setToolTipText("");
jRBDestine.setText("按预约查询");
jPCON.setBorder(BorderFactory.createEtchedBorder());
jPCON.setLayout(xYLayout2);
BGQueryChange.add(jRBDestine); //按预约查询
BGQueryChange.add(jRBCON); //按入住查询
BGQueryChange.add(jRBBadRoom); //按坏房查询
BGQueryChange.add(jRBRoomClass); //按客房类型查询
BGQueryChange.add(jRBRoomID); //按客房ID查询
BGQueryChange.add(jRBBedNom); //按客房床位数查询
this.getContentPane().add(jPCON, new XYConstraints(1, 164, 101, 35));
jPCON.add(jRBCON, new XYConstraints(3, 5, -1, -1));
this.getContentPane().add(jPDestine, new XYConstraints(2, 200, 100, 35));
jPDestine.add(jRBDestine, new XYConstraints(2, 3, -1, -1));
this.getContentPane().add(jSPShowRoomInfo,
new XYConstraints(2, 5, 408, 156));
jSPShowRoomInfo.getViewport().add(jTable1);
this.getContentPane().add(jPCommand,
new XYConstraints(327, 163, 83, 109));
this.getContentPane().add(jPBedNom, new XYConstraints(106, 237, 220, 35));
this.getContentPane().add(jPRoomClass,
new XYConstraints(106, 199, 220, 35));
this.getContentPane().add(jPRoomID, new XYConstraints(106, 163, 220, 35));
jCBRoomClass.setEnabled(false); //按客房类型
jCBRoomClass.addItem(" ");
jCBRoomClass.addItem("标准单人间");
jCBRoomClass.addItem("标准双人间");
jCBRoomClass.addItem("标准四人间");
jCBRoomClass.addItem("家庭间");
jCBRoomClass.addItem("商务间");
jCBRoomClass.addItem("经济间");
jCBRoomClass.addItem("豪华套房");
jTFRoomID.setEnabled(false); //按客房ID
jTFBedNom.setEnabled(false); //按床位
}
public void jBQuit_actionPerformed(ActionEvent e) { //退出
this.setVisible(false);
}
public void jBQuery_actionPerformed(ActionEvent e) {
if (BGQueryChange.getSelection() == jRBDestine.getModel()) { //按预约查询
table.fetch("Select HIMS_RoomInfo.RoomID as 客房ID,Class as 客房类型,RoomArea as 房间面积,BedNo as 床位数,StandardPri as 标准价,RebatePri as 折扣价,Place as 客房位置,RoomIntro as 客房信息,Remark as 备注 From HIMS_RoomState, HIMS_RoomInfo where HIMS_RoomState.RoomID = HIMS_RoomInfo.RoomID AND HIMS_RoomState.OnUser = '3'; ");
if (jTable1.getRowCount() == 0) {
JOptionPane.showMessageDialog(null,
"没有预约的客房!!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
}
return;
}
if (BGQueryChange.getSelection() == jRBCON.getModel()) { //按入住查询
table.fetch("Select HIMS_RoomInfo.RoomID as 客房ID,Class as 客房类型,RoomArea as 房间面积,BedNo as 床位数,StandardPri as 标准价,RebatePri as 折扣价,Place as 客房位置,RoomIntro as 客房信息,Remark as 备注 From HIMS_RoomState, HIMS_RoomInfo where HIMS_RoomState.RoomID = HIMS_RoomInfo.RoomID AND HIMS_RoomState.OnUser = '1' Or HIMS_RoomState.OnUser = '7' or HIMS_RoomState.OnUser = '8' Or HIMS_RoomState.OnUser = '9' Or HIMS_RoomState.OnUser = '0'; ");
if (jTable1.getRowCount() == 0) {
JOptionPane.showMessageDialog(null,
"没有入住的客房!!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
}
return;
}
if (BGQueryChange.getSelection() == jRBBadRoom.getModel()) { //按坏房查询
table.fetch("Select HIMS_RoomInfo.RoomID as 客房ID,Class as 客房类型,RoomArea as 房间面积,BedNo as 床位数,StandardPri as 标准价,RebatePri as 折扣价,Place as 客房位置,RoomIntro as 客房信息,Remark as 备注 From HIMS_RoomState, HIMS_RoomInfo where HIMS_RoomState.RoomID = HIMS_RoomInfo.RoomID AND HIMS_RoomState.OnUser = '5'; ");
if (jTable1.getRowCount() == 0) {
JOptionPane.showMessageDialog(null,
"没有坏的客房!!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
}
return;
}
if (BGQueryChange.getSelection() == jRBRoomClass.getModel()) { //按客房类型查询
String strClass = null;
try {
strClass = jCBRoomClass.getSelectedItem().toString();
} catch (Exception ex) {
strClass = "";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -