酒店管理系统实现代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

//入住importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.border.Border;importjavax.swing.text.*;publicclassA1extendsJFrameimplementsWindowListener{//定义各个组件JFrameframe=newJFrame(入住系统);JLabelnameLabel=newJLabel(客户姓名);JLabelidtifyLabel=newJLabel(身份证号);JLabelroomLabel=newJLabel(入住房号);JLabelmoneyLabel=newJLabel(应付金额);JTextFieldnameField=newJTextField();JTextFieldidtifyField=newJTextField();JTextFieldroomField=newJTextField();JTextFieldmoneyField=newJTextField();JButtonbutton1,button2;/*publicstaticvoidmain(Stringargs[]){A1a1=newA1();a1.go();}*/publicvoidgo(){UpperCaseDocumentucDocument=newUpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);//frame.addWindowListener(this);nameField.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){Stringusername=nameField.getText();}});JComboBoxjcb1;//组合框String[]itemList={现金,刷卡};jcb1=newJComboBox(itemList);jcb1.setSelectedIndex(0);button1=newJButton(确认支付);button2=newJButton(取消支付);finalJPanelp1=newJPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(newGridLayout(3,1));Borderetched=BorderFactory.createEtchedBorder();Borderborder=BorderFactory.createTitledBorder(etched,付款方式);p1.setBorder(border);button1.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){if(e.getActionCommand()==确认支付){JOptionPane.showMessageDialog(p1,支付成功,success,JOptionPane.INFORMATION_MESSAGE);}}});button2.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){if(e.getActionCommand()==取消支付){JOptionPane.showMessageDialog(p1,支付失败,failure,JOptionPane.INFORMATION_MESSAGE);}}});idtifyField.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){Stringidtify=idtifyField.getText();Stringidtifyword=newString(idtify);}});roomField.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){Stringroom=roomField.getText();Stringroomword=newString(room);}});moneyField.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){Stringmoney=moneyField.getText();Stringidtifyword=newString(money);}});//面板labelPanel放标签JPanellabelPanel=newJPanel();labelPanel.setLayout(newGridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(idtifyLabel);labelPanel.add(roomLabel);labelPanel.add(moneyLabel);//面板fieldPanel放文本框JPanelfieldPanel=newJPanel();fieldPanel.setLayout(newGridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(idtifyField);fieldPanel.add(roomField);fieldPanel.add(moneyField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanelnorthPanel=newJPanel();northPanel.setLayout(newGridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Containercp=frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);frame.setSize(200,250);frame.setVisible(true);}publicvoidwindowClosing(WindowEvente1){System.exit(0);}publicvoidwindowOpened(WindowEvente2){}publicvoidwindowIconified(WindowEvente3){}publicvoidwindowDeiconified(WindowEvente4){}publicvoidwindowClosed(WindowEvente5){}publicvoidwindowActivated(WindowEvente6){}publicvoidwindowDeactivated(WindowEvente7){}}classUpperCaseDocumentextendsPlainDocument{publicvoidinsertString(intoffset,Stringstring,AttributeSetattributeSet)throwsBadLocationException{string=string.toUpperCase();super.insertString(offset,string,attributeSet);}}第二个://退房importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.border.Border;importjavax.swing.text.*;publicclassA2extendsJFrame{//定义各个组件JFrameframe=newJFrame(退房系统);JLabelnameLabel=newJLabel(客户姓名);JLabelidtifyLabel=newJLabel(身份证号);JLabelroomLabel=newJLabel(退房号);JLabeltimeLabel=newJLabel(退房时间);JTextFieldnameField=newJTextField();JTextFieldidtifyField=newJTextField();JTextFieldroomField=newJTextField();JTextFieldtimeField=newJTextField();JButtonbutton1,button2;//JTextAreata=newJTextArea(5,20);/*publicstaticvoidmain(Stringargs[]){A2a2=newA2();a2.go();}*/publicvoidgo(){UpperCaseDocumentucDocument=newUpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){Stringusername=nameField.getText();}});button1=newJButton(是);button2=newJButton(否);finalJPanelp1=newJPanel();p1.add(button1);p1.add(button2);p1.setLayout(newGridLayout(2,1));Borderetched=BorderFactory.createEtchedBorder();Borderborder=BorderFactory.createTitledBorder(etched,是否结清消费账单);p1.setBorder(border);button1.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){if(e.getActionCommand()==是){JOptionPane.showMessageDialog(p1,谢谢您的大力支持!,success,JOptionPane.INFORMATION_MESSAGE);}}});button2.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){if(e.getActionCommand()==否){JOptionPane.showMessageDialog(p1,请结清消费账单,failure,JOptionPane.INFORMATION_MESSAGE);}}});idtifyField.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){Stringidtify=idtifyField

1 / 58
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功