📄 mainframe.java
字号:
this.lbl4.setIcon(i4);
this.lbl5.setIcon(i5);
this.lbl6.setIcon(i6);
this.lbl7.setIcon(i7);
this.lbl8.setIcon(i8);
this.lbl9.setIcon(i9);
lbl8.setText("");
lbl9.setText("");
lbl0.setText("");
lblMakerInfo.setFont(new java.awt.Font("华文彩云", Font.PLAIN, 13));
lblMakerInfo.setForeground(Color.blue);
lblMakerInfo.setBorder(BorderFactory.createEtchedBorder());
lblMakerInfo.setText("");
lblMakerInfo.setBounds(new Rectangle(1, 22, 186, 25));
MenuBar.add(mnuRummery);
MenuBar.add(mnuGuestInfo);
MenuBar.add(mnuroomInfo);
MenuBar.add(EmInfo);
MenuBar.add(mnuBusinessInfo);
MenuBar.add(mnuSystemInfo);
MenuBar.add(mnuHelp);
contentPane.add(ToolBar);
ToolBar.add(btnRegistRoom);
ToolBar.add(btnReturnRoom);
ToolBar.add(btnQueryRoom);
ToolBar.add(btnEmInfo);
ToolBar.add(btnBusinessTb);
ToolBar.add(btnAdminInfo);
ToolBar.add(btnExit);
contentPane.add(mainPanel);
mainPanel.add(lbl1, "lbl1");
mainPanel.add(lbl2, "lbl2");
mainPanel.add(lbl3, "lbl3");
mainPanel.add(lbl4, "lbl4");
mainPanel.add(lbl5, "lbl5");
mainPanel.add(lbl6, "lbl6");
mainPanel.add(lbl7, "lbl7");
mainPanel.add(lbl8, "lbl8");
mainPanel.add(lbl9, "lbl9");
mainPanel.add(lbl0, "lbl0");
contentPane.add(jPanel1);
jPanel1.add(lblMakerInfo);
jPanel1.add(lblAdminInfo);
jPanel1.add(lblShowTime);
mnuRummery.add(mnuIntro);
mnuGuestInfo.add(mnuGuestRegistInfo);
mnuGuestInfo.add(mnuReturnInfo);
mnuroomInfo.add(mnuQueryRoom);
mnuroomInfo.add(mnuUpdateStatus);
mnuBusinessInfo.add(mnuGusetCheckInfo);
mnuBusinessInfo.add(mnuDailyInfo);
mnuSystemInfo.add(mnuDataAdmin);
mnuSystemInfo.add(mnuAdmin);
mnuHelp.add(mnuaboutMe);
EmInfo.add(mnuBaseInfo);
EmInfo.add(mnuOnDuty);
mnuAdmin.add(mnuRegistAdmin);
mnuDataAdmin.add(munInit);
popmnu.add(jMenuItem6);
popmnu.add(jMenuItem5);
popmnu.add(jMenuItem4);
popmnu.add(jMenuItem3);
popmnu.add(jMenuItem1);
popmnu.add(jMenuItem2);
setJMenuBar(MenuBar);
this.btnRegistRoom.setIcon(new ImageIcon("image\\main\\registe.jpg"));
this.btnReturnRoom.setIcon( new ImageIcon("image\\main\\return.jpg"));
this.btnAdminInfo.setIcon(new ImageIcon("image\\main\\admin.jpg"));
this.btnBusinessTb.setIcon(new ImageIcon("image\\main\\business.jpg"));
this.btnEmInfo.setIcon(new ImageIcon("image\\main\\employeeInfo.jpg"));
this.btnExit.setIcon(new ImageIcon("image\\main\\exit.jpg"));
this.btnQueryRoom.setIcon(new ImageIcon("image\\main\\query.jpg"));
this.lblMakerInfo.setIcon(new ImageIcon("image\\main\\makerInfo.jpg"));
this.lblAdminInfo.setText("当前登录: " + login.manager);
showTime();
isUnable();
showPic();
}
public void showPic() {
ActionListener show = new ActionListener() {
public void actionPerformed(ActionEvent e) {
number++;
String name = "lbl" + number;
card.show(mainPanel, name);
if (number == 9) {
number = 0;
}
}
};
timer2 = new Timer(800, show);
timer2.start();
}
public void isUnable() {
if (login.manager.equals("系统管理员")) {
this.mnuDataAdmin.setEnabled(true);
this.mnuAdmin.setEnabled(true);
this.mnuBaseInfo.setEnabled(true);
this.mnuUpdateStatus.setEnabled(true);
this.mnuDailyInfo.setEnabled(true);
this.mnuGusetCheckInfo.setEnabled(true);
}
if (login.manager.equals("经营管理员")) {
this.mnuBaseInfo.setEnabled(true);
this.mnuUpdateStatus.setEnabled(true);
this.mnuDailyInfo.setEnabled(true);
this.mnuGusetCheckInfo.setEnabled(true);
this.mnuDataAdmin.setEnabled(false);
this.mnuAdmin.setEnabled(false);
}
}
public void showTime() {
ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent e) {
// Calendar cal = Calendar.getInstance();
// String showTime = "";
// showTime = "当前时间:" + cal.get(Calendar.YEAR) + "-" +
// (cal.get(Calendar.MONTH) + 1) + "-" +
// cal.get(Calendar.DATE);
// showTime += " " + cal.get(Calendar.HOUR) + ":" +
// cal.get(Calendar.MINUTE) + ":" +
// cal.get(Calendar.SECOND);
// lblShowTime.setText(showTime);
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy年MM月dd日 HH:mm:ss");
lblShowTime.setText("系统时间: " + sdf.format(d));
}
};
timer = new Timer(1000, al);
timer.start();
}
/**
* Help | About action performed.
*
* @param actionEvent ActionEvent
*/
public void mnuaboutMe_actionPerformed(ActionEvent e) {
MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.show();
}
/**
* File | Exit action performed.
*
* @param actionEvent ActionEvent
*/
public void btnExit_actionPerformed(ActionEvent e) {
System.exit(0);
}
public void mnuQueryRoom_actionPerformed(ActionEvent e) {
QueryRoomFrame queryRoom = new QueryRoomFrame();
queryRoom.setBounds(200, 200, 700, 550);
queryRoom.setVisible(true);
}
public void mnuUpdateStatus_actionPerformed(ActionEvent e) {
ResetStatusFrame resetStatus = new ResetStatusFrame();
resetStatus.setBounds(200, 200, 700, 550);
resetStatus.show();
}
public void mnuGuestRegistInfo_actionPerformed(ActionEvent e) {
RegisterFrame register = new RegisterFrame();
register.setBounds(200, 200, 700, 550);
register.show();
}
public void mnuReturnInfo_actionPerformed(ActionEvent e) {
ReturnRoomFrame returnRoom = new ReturnRoomFrame();
returnRoom.setBounds(200, 200, 700, 550);
returnRoom.show();
}
public void mnuDailyInfo_actionPerformed(ActionEvent e) {
DailyEarningFrame dailyEarning = new DailyEarningFrame();
dailyEarning.setBounds(200, 200, 700, 550);
dailyEarning.show();
}
public void mnuBaseInfo_actionPerformed(ActionEvent e) {
EmployeeFrame employee = new EmployeeFrame();
employee.setBounds(200, 200, 700, 550);
employee.show();
}
public void jMenuItem1_actionPerformed(ActionEvent e) {
Object[] op = {"确定", "取消"};
int op1 = JOptionPane.showOptionDialog(this,
"如果初始化数据库,数据信息将全部丢失!!\n确定初始化数据库吗!!",
"提示",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE, null,
op, op[1]);
if(op1==1)
{
JOptionPane.showMessageDialog(this, "您放弃初始化数据库操作!!", "提示",
JOptionPane.INFORMATION_MESSAGE);
return;
}
int op2 = JOptionPane.showOptionDialog(this,
"如果初始化数据库,数据信息将全部丢失!!\n再次确定初始化数据库吗!!",
"提示",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE, null,
op, op[1]);
if (op1 == 0 && op2 == 0) {
JOptionPane.showMessageDialog(this, "数据库初始化成功!!", "提示",
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(this, "您放弃初始化数据库操作!!", "提示",
JOptionPane.INFORMATION_MESSAGE);
}
}
public void mnuIntro_actionPerformed(ActionEvent e) {
HotelIntro hotelIntro = new HotelIntro();
hotelIntro.setBounds(200, 200, 700, 550);
hotelIntro.show();
}
public void mnuGusetCheckInfo_actionPerformed(ActionEvent e) {
DailyGusetFrame dailyGuset = new DailyGusetFrame();
dailyGuset.setBounds(200, 200, 700, 550);
dailyGuset.show();
}
public void mnuRegistAdmin_actionPerformed(ActionEvent e) {
AdminManageFrame adminManage = new AdminManageFrame();
adminManage.setBounds(200, 200, 700, 550);
adminManage.show();
}
public void mnuOnDuty_actionPerformed(ActionEvent e) {
OnDutyFrame onduty = new OnDutyFrame();
onduty.setBounds(200, 200, 700, 550);
onduty.show();
}
public void lblShowTime_mouseClicked(MouseEvent e) {
CalendarFrm calendar = new CalendarFrm();
calendar.setBounds(200, 200, 500, 400);
calendar.show();
}
public void btnRegistRoom_actionPerformed(ActionEvent e) {
mnuGuestRegistInfo_actionPerformed(e);
}
public void btnReturnRoom_actionPerformed(ActionEvent e) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -