📄 setup.java
字号:
String sqlCode = "select a.pk,a.r_type_id,a.id 房间号,b.r_type 房间类型," +
"a.state 房间状态,a.location 所在区域,a.r_tel 房间电话 from roominfo as a," +
"roomtype as b where a.r_type_id = b.id and a.delmark = 0 " + rType;
sunsql.initDTM(dtm12,sqlCode);
tb12.removeColumn(tb12.getColumn("pk"));
tb12.removeColumn(tb12.getColumn("r_type_id"));
}
/**=======================================================================**
* [## private JPanel kehu() {} ]:
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :客户类型设置
**=======================================================================**
*/
private JPanel kehu() {
dtm21 = new DefaultTableModel();
tb21 = new JTable(dtm21);
sp21 = new JScrollPane(tb21);
dtm22 = new DefaultTableModel();
tb22 = new JTable(dtm22);
sp22 = new JScrollPane(tb22);
JPanel pkehu,p1,p2,p1b,p2b;
p1 = new JPanel(new BorderLayout());//客户类型面板
p2 = new JPanel(new BorderLayout());//房间费打折面板
p1b = new JPanel(new FlowLayout(FlowLayout.CENTER,30,5));//客户类型按钮面板
p2b = new JPanel(); //房间费打折按钮面板
buildDTM21(); //初始化客户类型表
bt21 = new TJButton ("pic/new.gif", "添加类型", "添加客户类型");
bt22 = new TJButton ("pic/modi0.gif", "修改类型", "修改客户类型");
bt23 = new TJButton ("pic/del.gif", "删除类型", "删除客户类型");
p1b.add(bt21);
p1b.add(bt22);
p1b.add(bt23);
p1.add(sp21);
p1.add("South",p1b);
p1.setBorder ( BorderFactory.createTitledBorder ("客户类型") );
buildDTM22(); //初始化房间打折表
bt24 = new TJButton ("pic/modi3.gif", " 房间费打折 ", "设置房间费折扣");
p2b.add(bt24);
p2.add(sp22);
p2.add("South",p2b);
p2.setBorder ( BorderFactory.createTitledBorder ("房间费打折") );
pkehu = new JPanel(new GridLayout(2,1,0,10));
pkehu.add(p1);
pkehu.add(p2);
return pkehu;
}
/**=======================================================================**
* [## private JPanel caozuo() {} ]:
* 参数 :无
* 返回值 :JPanel
* 修饰符 :private
* 功能 :操作员设置
**=======================================================================**
*/
private JPanel caozuo() {
JPanel panelMain,panelMain1,panelTop,panelBott1,panelBott2;
dtm31 = new DefaultTableModel();
tb31 = new JTable(dtm31);
sp31 = new JScrollPane(tb31);
panelMain = new JPanel(new GridLayout(2,1,0,5));
panelMain1 = new JPanel (new BorderLayout (0,3)); //下半面板
panelTop = new JPanel(new GridLayout(1,1)); //操作员列表面板
panelBott1 = new JPanel(new GridLayout (1, 2));//详细信息,操作范围,操作权限面板
panelBott2 = new JPanel(new FlowLayout (FlowLayout.CENTER,20,5));//按钮面板
bt31 = new TJButton ("pic/new.gif", " 登 记 ", "保存当前用户信息", false);
bt32 = new TJButton ("pic/key.gif", " 修 改 ", "修改密码", false);
bt33 = new TJButton ("pic/del.gif", " 删 除 ", "删除当前用户", false);
bt32.setEnabled(false);
bt33.setEnabled(false);
panelBott2.add (bt31);
panelBott2.add (bt32);
panelBott2.add (bt33);
//制作并加入Top_Left面板
panelBott1.add (bottLeft());
//制作并加入Top_Right面板
panelBott1.add (bottRight());
panelMain1.add ("Center", panelBott1);
panelMain1.add ("South", panelBott2);
buildDTM31(); //初始化操作员信息表
panelTop.add(sp31);
panelTop.setBorder(BorderFactory.createTitledBorder("操作员列表"));
panelMain.add(panelTop);
panelMain.add(panelMain1);
return panelMain;
}
/**=======================================================================**
* [## private JPanel topLeft () {} ]: 制作Top_Left面板
* 参数 :无
* 返回值 :JPanel表示组织好的面板
* 修饰符 :private
* 功能 :组建对话框的用户名和密码面板
**=======================================================================**
*/
private JPanel bottLeft () {
JLabel lb1, lb2, lb3, lb4;
JPanel tl, jp1, jp2;
lb1 = new JLabel ("用 户 名: ");
lb2 = new JLabel ("原 密 码: ");
lb3 = new JLabel ("新 密 码: ");
lb4 = new JLabel ("确认密码: ");
tf31 = new TJPasswordField (17);
tf32 = new TJPasswordField (17);
tf33 = new TJPasswordField (17);
tl = new JPanel ();
jp1 = new JPanel (new GridLayout (4, 1, 0, 18));
jp2 = new JPanel (new GridLayout (4, 1, 0, 9));
//初始化用户名下拉框
cb31 = new JComboBox ();
cb31.setEditable (true);
tf31.setEditable (false);
//加入组件
jp1.add (lb1);
jp1.add (lb2);
jp1.add (lb3);
jp1.add (lb4);
jp2.add (cb31);
jp2.add (tf31);
jp2.add (tf32);
jp2.add (tf33);
tl.add (jp1);
tl.add (jp2);
tl.setBorder (BorderFactory.createTitledBorder (" 详细信息 "));
return tl;
}
/**=======================================================================**
* [## private JPanel topRight () {} ]: 制作Top_Right面板
* 参数 :无
* 返回值 :JPanel表示组织好的面板
* 修饰符 :private
* 功能 :组建对话框操作面板
**=======================================================================**
*/
private JPanel bottRight () {
JPanel tr, jp1, jp2;
ButtonGroup bg1,bg2;
rb31 = new JRadioButton ("新用户登记", true);
rb32 = new JRadioButton ("修改密码");
rb33 = new JRadioButton ("删除用户");
rb34 = new JRadioButton ("普通操作员", true);
rb35 = new JRadioButton ("管 理 员");
bg1 = new ButtonGroup ();
bg2 = new ButtonGroup ();
tr = new JPanel (new GridLayout (2, 1));
jp1 = new JPanel ();
jp2 = new JPanel ();
//加单选组 操作范围
bg1.add (rb31);
bg1.add (rb32);
bg1.add (rb33);
//加单选组 操作权限
bg2.add (rb34);
bg2.add (rb35);
jp1.add (rb31);
jp1.add (rb32);
jp1.add (rb33);
jp2.add (rb34);
jp2.add (rb35);
jp1.setBorder (BorderFactory.createTitledBorder (" 操作范围 "));
jp2.setBorder (BorderFactory.createTitledBorder (" 操作权限 "));
tr.add (jp1);
tr.add (jp2);
return tr;
}
/**=======================================================================**
* [## private void buildDTM21() {} ]:
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :初始化客户类型列表
**=======================================================================**
*/
private void buildDTM21() {
String sqlCode = "select pk,id 客户类型编号,id,c_type 客户类型,discount " +
"打折比率 from customertype where delmark = 0 and dis_attr = '购物折扣' and id!='SYSMARK'";
sunsql.initDTM(dtm21,sqlCode);
tb21.removeColumn(tb21.getColumn("pk"));
tb21.removeColumn(tb21.getColumn("id"));
}
/**=======================================================================**
* [## private void buildDTM22() {} ]:
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :初始化房间打折费列表
**=======================================================================**
*/
private void buildDTM22() {
String sqlCode = "select pk,sysmark,id,foregift,r_type 房间类型,price 预设单价 from roomtype where delmark = 0";
sunsql.initDTM(dtm22,sqlCode);
tb22.removeColumn(tb22.getColumn("pk"));
tb22.removeColumn(tb22.getColumn("id"));
tb22.removeColumn(tb22.getColumn("sysmark"));
tb22.removeColumn(tb22.getColumn("foregift"));
}
/**=======================================================================**
* [## private void buildDTM31() {} ]:
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :初始化操作员列表
**=======================================================================**
*/
private void buildDTM31() {
String sqlCode = "select pk,userid 用户登录ID,puis 用户权限 from pwd where delmark = 0";
sunsql.initDTM(dtm31,sqlCode);
tb31.removeColumn(tb31.getColumn("pk"));
sunsql.initJComboBox (cb31, "select userid from pwd where delmark=0");
}
/**=======================================================================**
* [## private JPanel jiFei() {} ]:
* 参数 :无
* 返回值 :JPanel
* 修饰符 :private
* 功能 :计费设置
**=======================================================================**
*/
private JPanel jiFei() {
JLabel lb1, lb2, lb3, lb4, lb5, lb6, lb7, lb8, lb9, lb10,
lb11, lb12, lb13, lb14, lb15, lb16;
//定义各方位面板
JPanel panelJF, jfTop, jfLeft, jfRight, jfBott;
JPanel jp1, jp2, jp3, jp4, jp5, jp6, jp7, jp8, jp9;
//定义标签
lb1 = new JLabel(" 客人开房时间在");
lb2 = new JLabel("点之后按新的一天开始计费");
lb3 = new JLabel(" 客人退房时间在");
lb4 = new JLabel("点之后计价天数自动追加半天");
lb5 = new JLabel(" 客人退房时间在");
lb6 = new JLabel("点之后计价天数自动追加一天");
lb7 = new JLabel(" 开房后");
lb8 = new JLabel("分钟开始计费");
lb9 = new JLabel(" 最少按");
lb10 = new JLabel("小时计费,小于这个时间的按此时间计费");
lb11 = new JLabel(" 若不足一小时但超过");
lb12 = new JLabel("分钟的部分按1小时计费");
lb13 = new JLabel(" 不足上面分钟数但超过");
lb14 = new JLabel("分钟的部分按半小时计费");
lb15 = new JLabel("注:此设置仅限于标准计费的钟点房! ");
lb16 = new JLabel(" ");
lb15.setForeground(new Color(255, 138, 0));
//初始化计时计费设置
tf41 = new TJTextField(sunini.getIniKey("In_Room"), 5);
tf42 = new TJTextField(sunini.getIniKey("Out_Room1"), 5);
tf43 = new TJTextField(sunini.getIniKey("Out_Room2"), 5);
tf44 = new TJTextField(sunini.getIniKey("ClockRoom1"), 5);
tf45 = new TJTextField(sunini.getIniKey("ClockRoom2"), 5);
tf46 = new TJTextField(sunini.getIniKey("InsuHour1"), 5);
tf47 = new TJTextField(sunini.getIniKey("InsuHour2"), 5);
//设置文本框右对齐
tf41.setHorizontalAlignment(JTextField.RIGHT);
tf42.setHorizontalAlignment(JTextField.RIGHT);
tf43.setHorizontalAlignment(JTextField.RIGHT);
tf44.setHorizontalAlignment(JTextField.RIGHT);
tf45.setHorizontalAlignment(JTextField.RIGHT);
tf46.setHorizontalAlignment(JTextField.RIGHT);
tf47.setHorizontalAlignment(JTextField.RIGHT);
//不足一天是否按一天计价
ck = new JCheckBox("入住时间不足一天的按一天计费");
if(sunini.getIniKey("InsuDay").equals("1")) {
ck.setSelected(true);
}
bt41 = new TJButton ("pic/save.gif", " 保 存 ", "保存当前设置");
bt42 = new TJButton ("pic/exit.gif", " 返 回 ", "返回主窗口");
panelJF = new JPanel(new BorderLayout()); //计费主面板
jfTop = new JPanel(new GridLayout(2, 1)); //放左右面板
jfLeft = new JPanel(new GridLayout(4, 1)); //计费左面板
jfRight = new JPanel(new GridLayout(5, 1)); //计费右面板
jfBott = new JPanel(new FlowLayout(FlowLayout.RIGHT, 40, 4));//按键面板
jp1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); //左边的面板用到的
jp2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp5 = new JPanel(new FlowLayout(FlowLayout.LEFT)); //右边的面板用到的
jp6 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp7 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp8 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp9 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
//制作左边面板
jp1.add(lb1);
jp1.add(tf41);
jp1.add(lb2);
jp2.add(lb3);
jp2.add(tf42);
jp2.add(lb4);
jp3.add(lb5);
jp3.add(tf43);
jp3.add(lb6);
jp4.add(lb16); //假空格
jp4.add(ck);
jfLeft.add(jp1);
jfLeft.add(jp2);
jfLeft.add(jp3);
jfLeft.add(jp4);
//制作右边面板
jp5.add(lb7);
jp5.add(tf44);
jp5.add(lb8);
jp6.add(lb9);
jp6.add(tf45);
jp6.add(lb10);
jp7.add(lb11);
jp7.add(tf46);
jp7.add(lb12);
jp8.add(lb13);
jp8.add(tf47);
jp8.add(lb14);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -