1、房间表(房号,房类型,价格,押金,房状态)开房客人表(客人姓名,性别,证件类型,证件号码,房类型,房号,联系电话,入住时间,预计离开时间)预订客人表(客人姓名,性别,证件类型,证件号码,房类型,房号,联系电话,预计入住时间,预计离开时间)历史客人表(客人姓名,性别,证件类型,证件号码,房类型,房号,联系电话,入住日期,离开日期)四、 详细设计系统运行的主要界面如下:登陆界面:在登陆界面的密码JTextField中添加了KeyListener,使用户输入密码后按回车键就能登录到系统,代码如下:jtextfield_key.addKeyListener(new KeyAdapter() publi
2、c void keyPressed(KeyEvent e) / TODO Auto-generated method stubsuper.keyPressed(e);if(e.getKeyChar()=KeyEvent.VK_ENTER)String user_name=jtextfield_user.getText().toString();String user_key=new String(jtextfield_key.getPassword();/获取JPasswordField中的内容用此方法!if(user_name.equals()|user_key.equals()JOptio
3、nPane.showMessageDialog(null, 用户名或密码不能为空!);return;elseif(db.checkUser(user_name, user_key)mfa=new MainFrame_Admin();mfa.setVisible(true);setVisible(false);else if(n=3)JOptionPane.showMessageDialog(null, 连续三次输入输入错误,系统将自动关闭!System.exit(0);JOptionPane.showMessageDialog(null, 输入错误,还有+(3-n)+次输入机会n+;jtext
4、field_user.setText(jtextfield_key.setText(return;);登陆后的主界面:在本界面中插入了gif图片作为背景图,通过继承JPanel类,并复写paintComponent()方法使图片能处于JFrame框架的底层,使得窗口中放置其他组件比较容易,且外观比较好,代码如下:package design;import java.awt.Graphics;import java.awt.Image;import java.awt.Toolkit;import javax.swing.JPanel;public class myPanel extends JP
5、anel/* * */private static final long serialVersionUID = 1L;private Image image=null;public myPanel()image=Toolkit.getDefaultToolkit().getImage(.imagemainframe.gifOverrideprotected void paintComponent(Graphics g) / TODO Auto-generated method stubsuper.paintComponent(g);g.drawImage(image, 0, 0, 800, 6
6、00, getParent();在选择完房间类型后,当房间号的JTextField获取焦点和失去焦点时,会自动出现提示信息,代码如下:jtextfield_room.addFocusListener(new FocusAdapter() Overridepublic void focusGained(FocusEvent e) super.focusGained(e);if(jcombobox_room_type.getSelectedIndex()=0)jlabel_tip_room_type.setText(普通单人间的房间号码为:101109if(jcombobox_room_type.
7、getSelectedIndex()=1)普通双人间的房间号码为:201209if(jcombobox_room_type.getSelectedIndex()=2)豪华单人间的房间号码为:301309if(jcombobox_room_type.getSelectedIndex()=3)豪华双人间的房间号码为:401409public void focusLost(FocusEvent e) super.focusLost(e);int n;String pledge_string=db.getPledge(jtextfield_room.getText();jtextfield_pledg
8、e.setText(pledge_string);if(jtextfield_room.getText().equals(n=0;elsen=Integer.parseInt(jtextfield_room.getText();if(jcombobox_room_type.getSelectedIndex()=0&(n109)JOptionPane.showMessageDialog(null, 房间号输入有误!return ;if(jcombobox_room_type.getSelectedIndex()=1&201|n209)if(jcombobox_room_type.getSelec
9、tedIndex()=2&301|n309)if(jcombobox_room_type.getSelectedIndex()=3&401|n409)if(db.isRoomEmpty(jtextfield_room.getText()=false)此房间已经有客人!return;房状态查看可显示各个房间的状态与基本信息,预订管理的界面如下:信息查询的界面如下:查询的界面中“查找”按钮的代码如下:private JButton getJButton_search()if(jbutton_search=null)jbutton_search=new JButton(查找jbutton_searc
10、h.setBounds(280, 10, 80, 30);jbutton_search.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) String num=jtextfield_input.getText();if(db.isIdentityNumExist_checkin(num)=false)证件号码不存在!elsejtable=getJTable(num);jscrollpane.setViewportView(jtable);jpanel.setVisible(false);jpanel2.setVisible(true);return jbutton_search;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1