




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、/入住import java。awt.;import java。awt.event.;import javax。swing。;import javax。swing.border。Border;import javax。swing.text。*;public class A1 extends JFrame implements WindowListener /定義各個組件JFrame frame = new JFrame (入住系統(tǒng)); JLabel nameLabel = new JLabel(”客戶姓名); JLabel idtifyLabel = new JLabe(身份證號); JLab
2、el roomLabel = new JLabel(入住房號”);JLabel moneyLabel = new JLabel”應付金 JTextField nameField = new JTextField(); JTextFieldidtifyField= new JTextField; JTextFieldroomField= new JTextField(); JTextField moneyField= new JTextFiel(; JButton button1,button2;/*public static void main(String args)A1 a1 = new
3、A1();a1。go();*/public void go()UpperCaseDocument ucDocument = new nameField.setDocument(ucDocument);nameField。setForeground(Color.black);/fram。addWindowListene(thi;nameField。addActionListener(new ActionListener() public void actionPerformed(ActionEvent e)String username = nameField.getText(););JComb
4、oBox jcb1;/組合框String itemList = 現(xiàn)金”, ”刷卡 ;jcb1 = new JComboBox(itemList);jcb1。setSelectedIndex(0); button1=new JButton(”確認支付); button2=new JButton final JPanel p1 = new JPanel(); p1.add(jcb1);p1。add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1);Border etched = BorderFactory。createEtchedB
5、order();Border border = BorderFactory.createTitledBorder(etched, ”付款方式);p1.setBorder(border);button1。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e.getActionCommand)JOptionPane.showMessageDialog(p1, success, JOptionPane.INFORMATION_MESSAGE););button2.addActionL
6、istener(new ActionListener()public void actionPerformed(ActionEvent e)if (e。getActionCommand()=取消支付”) JOptionPane.showMessageDialog(p1,支付失敗”,”failure, JOptionPane.INFORMATION_MESSAGE);;idtifyField。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)String idtify= idtifyFi
7、el。 String idtifyword= new String(idtify););roomField。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) String room= roomFiel String roomword= new String(room););moneyField。addActionListener(new ActionListener() public void actionPerformed(ActionEvent e)String money= m
8、oneyField。getText();String idtifyword= new String(mone;);/面板labelPanel 放標簽JPanel labelPanel = new JPanel();labelPanel。setLayout(new GridLayout(4,1);labelPanel。add(nameLabel); labelPanel.add(idtifyLabe; labelPanel.add(roomLabel);labelPanel。add(moneyLabel);/面板fieldPanel 放文本框JPanel fieldPanel = new JPa
9、ne(;fieldPanel。setLayout(new GridLayout(4,1) ;fieldPanel。add(nameField); fieldPanel.add(idtifyField);fieldPanel。add(roomField); fieldPanel.add( moneyField);/面板northPanel 放面板lanelPanel 和面板fieldPanelJPanel northPanel = new JPanel();northPanel。setLayout(new GridLayout(1,2);northPanel。add(labelPanel); n
10、orthPanel.add(fieldPanel);Container cp = frame.getContentPane();cp。add(northPanel,BorderLayout.NORTH);/northPanel 放在northcp。add(p1,BorderLayout.SOUTH);fram。 fram。setVisible(tru;public void windowClosing(WindowEvent e1)System.exit(0);public void windowOpened(WindowEvent e2)public void windowIconified
11、(WindowEvent e3)public void windowDeiconified(WindowEvent e4)public void windowClosed(WindowEvent e5)public void windowActivated(WindowEvent e6)public void windowDeactivated(WindowEvent eclass UpperCaseDocument extends PlainDocument public void insertString(int offset,String string, AttributeSet att
12、ributeSet)throws BadLocationExceptionstring = string。toUpperCase();super。insertString(offset,string, attributeSet);其次個:/退房import java.awt。; import java。awt。event.;import javax。swing。*;import javax。swing.border.Border;import javax.swing。text。; public class A2 extends JFrame /定義各個組件JFrame frame = new
13、JFrame (退房系統(tǒng)”); JLabel nameLabel = new JLabel(客戶姓名); JLabel idtifyLabel = new JLabe(身份證號); JLabel roomLabel = new JLabe(”退房號; JLabel timeLabel = new JLabel(退房時間”);JTextField nameField = new JTextFiel(; JTextFieldidtifyField= new JTextField(); JTextFieldroomField= new JTextField(); JTextFieldtimeFiel
14、d= new JTextField(); JButton button1,button2;/JTextArea ta = new JTextArea(5,20);/*public static void main(String args)A2 a2 = new A2();a2.g(;/public void go()UpperCaseDocument ucDocument = new nameFiel。setDocumenucDocumen; nameField.setForeground(Color。black);nameField。addActionListener(new ActionL
15、istener()public void actionPerformed(ActionEvent e) String username = nameFiel。getTex(;button1=new JButton(”是”);賬單”);button2=new JButton(否; final JPanel p1 = new JPanel();p1。add(button1); p1.add(button2);p1。setLayout(new GridLayout(2,1));Border etched = BorderFactory。createEtchedBorder();Border bord
16、er = BorderFactory。createTitledBorder(etched, ”是否結清消費p1。setBorder(border); button1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e。getActionCommand()=是) JOptionPane。showMessageDialog(p1,”感謝您的大力支持”success, JOptionPane.INFORMTION_MESSAG;);button2。addActionListener
17、(new ActionListener()public void actionPerformed(ActionEvent e)if (e。getActionCommand()=”否”) JOptionPane.showMessageDialog(p1,請結清消費賬單”,failure, JOptionPane.INFORMATION_MESSAGE););idtifyField。addActionListener(new ActionListener() public void actionPerformed(ActionEvent e)String idtify= idtifyField。g
18、etText();String idtifyword= new String(idtify);roomField.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) String room= roomField.getText(); String roomword= new String(room););timeField.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)St
19、ring time= timeFiel。getText; String timeword= new String(time););/面板labelPanel 放標簽JPanel labelPanel = new JPanel; labelPanel.setLayout(new GridLayout(4,1));labelPanel。add(nameLabel); labelPanel.add(idtifyLabel); labelPanel.add(roomLabel);labelPane。add(timeLabe;/面板fieldPanel 放文本框JPanel fieldPanel = n
20、ew JPanel();fieldPane。setLayout(new fieldPanel。add(nameField);fieldPanel。add(idtifyField); fieldPanel。add(roomField); fieldPane。ad(/面板northPanel 放面板lanelPanel 和面板fieldPanelJPanel northPanel = new JPanel(); northPanel.setLayout(new GridLayout(1,2); northPanel.add(labelPanel); northPanel.add(fieldPane
21、;Container cp = frame.getContentPane();cp。add(northPanel,BorderLayout.NORTH);/northPanel 放在northcp。add(p1,BorderLayout.SOUTH);/ fram。pac(;fram。 frame.setVisibltru;class UpperCaseDocument extends PlainDocument public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLoca
22、tionExceptionstring = string.toUpperCase();super。insertString(offset,string, attributeSet);第三個:/客房預訂import java。awt。; import java。awt.event。*;import javax。swing。;import javax.swing。border.Border;import javax.swing.text。*;public class A3 extends JFrame /定義各個組件JFrame frame = new JFrame (客房預訂);JLabel n
23、ameLabel = new JLabe(”預訂人姓名; JLabel numberLabel = new JLabel”手機號; JTextField nameField = new JTextFiel(; JTextFieldnumberField= new JTextField; JRadioButton rb1 = new JRadioButto(來電預訂 JRadioButton rb2 = new JRadioButton(電話預訂); JRadioButton rb3 = new JRadioButton(電傳預訂”);JRadioButton rb4 = new JRadioB
24、utton(”傳真預訂”);JRadioButton rb5 = new JRadioButto(”; JButton button1,button2;/*public static void main(String args)A3 a3 = new A3();a3。go();*/public void g(UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocumen;nameField。setForeground(Color。black); nameField.addActionL
25、istener(new ActionListener()public void actionPerformed(ActionEvent e) String username = nameFiel。getText;);JComboBox jcb1;/組合框String itemList = 總統(tǒng)套房,單人間 jcb1 = new JComboBox(itemLis; jcb1.setSelectedIndex(0);button1=new JButton(”是”); button2=new JButton(否”); final JPanel p1 = new JPanel();p1.add(jc
26、b;p1。add(button1);p1.add(button;p1.setLayou(new GridLayout(,1;Border etched = BorderFactory.createEtchedBorder;Border border = BorderFactory.createTitledBorde(etched, p1.setBorder(border);button1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e.getActionComman()
27、JOptionPane.showMessageDialog(p1,客人預訂成功”,success, JOptionPane.INFORMATION_MESSAGE););button2。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e.getActionCommand()=否) JOptionPane.showMessageDialog(p1, failure, JOptionPane.INFORMATION_MESSAGE););JPanel p2 = new JPane
28、l();p2。add(rb1);p2。add(rb2); p2.add(rb3);p2。add(rb4); p2p2。setLayout(new FlowLayout());border = BorderFactory。createTitledBorder(etched, 預訂方式);p2。setBorder(border);/創(chuàng)建ButtonGroup 按鈕組,并在組中添加按鈕ButtonGroup group1 = new ButtonGroup; group1。add(rb1);group1.add(rb2); group1。add(rb3);group1。add(rb4); group
29、1。add(rb5);numberField。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) String number= numberField.getText; String numberword= new String(number););/面板labelPanel 放標簽JPanel labelPanel = new JPanel();labelPanel。setLayout(new GridLayout(2,1) ;labelPane。add(nameLabe; labe
30、lPanel.add(numberLabel);/fieldPanel 放文本框JPanel fieldPanel = new JPanel();fieldPanel。setLayout(new GridLayout(2,1));fieldPanel。add(nameField); fieldPanel.ad(numberFiel;/面板northPanel 放面板lanelPanel 和面板fieldPanelJPanel northPanel = new JPanel();northPane。setLayou(new northPanel.add(labelPanel);northPane
31、l。add(fieldPanel); Container cp = frame.getContentPane();cp。add(northPanel,BorderLayout。NORTH);/northPanel 放在 northcp。add(p2,BorderLayout.CENTER);cp.add(p1,BorderLayout。SOUTH); fram。setSiz(200,33; frame.setVisible(true);class UpperCaseDocument extends PlainDocument public void insertString(int offse
32、t,String string, AttributeSet attributeSet)throws BadLocationException string = string.toUpperCase();super。insertString(offset,string, attributeSet);第四個/餐飲預訂import java。awt。;import java。awt。event。;import javax.swing.;import javax.swing。border.Border;import javax.swing.text.*;public class A4 extends
33、JFrame /定義各個組件JFrame frame = new JFrame (餐飲預訂”);JLabel nameLabel = new JLabel(”預訂人姓名);JLabel timeLabel = new JLabel(”預訂消費時間”); JTextField nameField = new JTextField; JTextFieldtimeField= new JTextField(); JCheckBox cb1 = new JCheckBox(中餐); JCheckBox cb2 = new JCheckBo(西; JCheckBox cb3 = new JCheckBo
34、x(紅酒”); JCheckBox cb4 = new JCheckBox”飲; JCheckBox cb5 = new JCheckBox(”甜點”); JCheckBox cb6 = new JCheckBo(水果); JButton button1,button2;/public static void main(String args)A4 a4 = new A4();a4.go();*/public void go()UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocum
35、ent); nameField.setForeground(Colo。blac;nameField。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) String username = nameField.getText();/ta。append(nUser Name : +username);;button1=new JButton(); button2=new JButton(否); final JPanel p1 = new JPanel();p1.add(button1);
36、p1.add(button2);p1。setLayout(new GridLayout(3,1);Border etched = BorderFactory。createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, ;p1。setBorder(border); button1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e.getActionCommand()=”是) JOp
37、tionPane.showMessageDialog(p1,success, JOptionPane.INFORMTION_MESSAG;);button2。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e.getActionCommand) JOptionPane.showMessageDialog(p1,failurJOptionPane.INFORMATION_MESSAGE);timeField。addActionListener(new ActionListene
38、r()public void actionPerformed(ActionEvent e)String time= timeField.getText();String timeword= new String(time););JPanel p2 = new p2。add(cb1);p2 p2.add(cb3); p2.ad(cb; p2。add(cb5);p2。add(cb6);Border etched1 = BorderFactory。createEtchedBorder();Border border1 = BorderFactory。createTitledBorder(etched
39、1, ”預訂內(nèi)容);p2.setBorder(border1);/面板labelPanel 放標簽JPanel labelPanel = new JPanel();labelPanel。setLayout(new GridLayout(4,1);labelPanel.add(nameLabe; labelPanel.add(timeLabel);/面板fieldPanel 放文本框JPanel fieldPanel = new JPane(; fieldPanel.setLayout(new GridLayout(4,1);fieldPanel.add(nameField); fieldPan
40、el。add(timeField);/面板northPanel 放面板lanelPanel 和面板fieldPanelJPanel northPanel = new JPanel(); northPanel.setLayout(new GridLayout(1,2)); northPanel.add(labelPanel);northPane。ad(fieldPane;Container cp = frame。getContentPane();cp。add(northPanel,BorderLayout。NORTH);/northPanel 放在northcadpBorderLayout.CE
41、NTE;cp.add(pBorderLayou。 frame.setSiz(200,35;frame。setVisible(true);class UpperCaseDocument extends PlainDocument public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException string = string.toUpperCase(); super.insertString(offset,string, attributeSet);第五
42、個:import java。awt.*; import java.awt。event.*;import javax。swing.*;import javax.swing。border。Border;import javax。swing。text。*; public class A5 extends JFrame /定義各個組件JFrame frame = new JFrame (”訂單管理);JLabel a1 = new JLabel(”訂單號”); JLabel a2 = new JLabel(”訂貨名稱); JLabel a3 = new JLabe(; JLabel a4 = new
43、JLabel(應收金額”);JLabel a5 = new JLabe(客戶名稱 JLabel a6 = new JLabel(結算方式);JLabel a7 = new JLabe(”;JTextField b1 = new JTextField(); JTextFieldb2= new JTextField(); JTextField b3= new JTextFieldb4= new JTextField();JTextField b5 = new JTextField();JTextField b6 = new JTextField();JTextField b7 = new JTex
44、tField(); JButton button1,button2;public static void main(String args)A5 a1 = new A5();a1.go();public void g(UpperCaseDocument ucDocument = newUpperCaseDocument();b1。setDocument(ucDocument);b1.setForeground(Colo。blac;b1。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)
45、 String username = b1。getText(););JComboBox jcb1;/組合框String itemList = 現(xiàn)金, ”刷卡” ;jcb1 = new JComboBox(itemList); jcb1.setSelectedInde(0;button1=new JButto(” button2=new JButton(”取消收款); final JPanel p1 = new JPanel();p1add(jcb;p1。add(button1);p1.add(button;p1.setLayout(new GridLayout(3,1) ;Border etc
46、hed = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorde(etched, p1。setBorder(border);button1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e。getActionCommand()=確認收款) JOptionPane。showMessageDialog(p1,收款成功,success,JOptionPane。INFOR
47、MATION_MESSAGE);button2.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)if (e.getActionCommand()=)JOptionPane.showMessageDialog(p1, failurJOptionPane.INFORMATION_MESSAGE););b1。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) String idti
48、fy= a1.getText();String idtifyword= new String(idtify););b2.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e)String room= a2.getText;String roomword= new String(room););b3。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) String money= a
49、3。getText();String idtifyword= new String(mone;);b4.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e)String money= a4。getText();String idtifyword= new String(money);b5。addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)String money= a5.get
50、Text();String idtifyword= new Strin(mone;);/labelPanel放標簽JPanel labelPanel = new JPanel();labelPanel。setLayout(new GridLayout(7,1));labelPanel.ada; labelPanel.add(a2); labelPane。add(a; labelPanel.add(a4); labelPanel。add(a5); labelPanel。add(a6); labelPanel.add(a7);/面板fieldPanel 放文本框JPanel fieldPanel
51、= new JPanel(); fieldPanel.setLayout(new GridLayout(7,1);fieldPanel.add(b1);fieldPanel.add(b2);fieldPanel.ad(b; fieldPanel.add( b4); fieldPanel.add( b5); fieldPanel.ad(b;fieldPanel。add( b7);/面板northPanel 放面板lanelPanel 和面板fieldPanelJPanel northPanel = new JPanel();northPanel。setLayout(new GridLayout(
52、1,2) ;northPane。add(labelPane; northPanel.add(fieldPane;Container cp = framgetContentPan(;cp。add(northPanel,BorderLayout。NORTH);/northPanel 放在northcp.add(p1,BorderLayout.SOUTH);frame。setDefaultCloseOperation(JFrame。EXIT_ON_CLOSE);frame.setSize(200,250);frame.setVisible(true);class UpperCaseDocument
53、extends PlainDocumentpublic void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationExceptionstring = string。toUpperCase(); super.insertString(offset,string, attributeSet);第六個:import java。awt.*; import java。awt.event.*; import javax。swing.*; import javax.swing.text。;i
54、mport javax。swing.border.*;public class Fprivate JFrame frame;private JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13;JTextArea ta = new JTextArea(20,20);JTextArea tb = new JTextArea(20,20);public static void main(String args)F that=new that.go();void go()frame=new JFrame(客房檢查);Container contentP
55、ane=frame.getContentPane();JPanel P1=new JPanel();P1.setLayou(new GridLayou(); b1=new JButton(101 n單人間; b2=new JButton(”102 n 單人間); b3=new JButto(103 n; b4=new JButton(104 n 單人間 ”);b5=new JButton(105 n單人間); b6=new JButton(201 n雙人間”); b7=new JButton(”202 n 雙人間); b8=new JButto(203 n雙人間; b9=new JButton
56、(204 n雙人間”); b10=new JButton(”205 n 雙人間”); b11=new JButton(301 n總統(tǒng)套房); b12=new JButton(302 n; b13=new JButton(”303 n 總統(tǒng)套房);b1。setBackground(Color.cyan);b2。setBackground(Color.cyan); b3。setBackground(Color.cyan); b4。setBackground(Color.cyan); b5。setBackground(Color.cyan);b6.setBackground(Color.magent
57、a);b7。setBackground(Color.magenta); b8。setBackground(Color.magenta);b9.setBackground(Color。magenta);b10。setBackground(Color。magenta); b1。setBackgrounColor.pin; b12.setBackground(Color.pin;b13。setBackground(Color.pink);P1.add(b1);P1.add(b2); P1。 P1.add(b4);P1.add(b; P1。add(b6); P1。add(b; P1。add(b8);
58、P1.add(b9); P1。add(b10);P1.add(b11); P1。add(b12);P1。add(b13);tb.append(房間總數(shù):13);tb.append”n; tb.append(n 當前可供:); P1.add(tb);ActionListener al=new ActionListene(public void actionPerformed(ActionEvent e)i(getActionComman(=101 n單人間 ta.setText(”);JFrame frame=new JFrame(”檢查信息);JPanel p2=newJPanel();Con
59、tainer cp=frame.getContentPane();t。appen(n101房間是否打掃:; ta.append(”n101 房間里是否有家具損壞: );t。append(n101房間是否交足余額:; JButton a=new JButton(”提交);p。add(;ActionListener al=new ActionListener()public void actionPerformed(ActionEvent e) if(e。getActionCommand()=提交)JOptionPane。showMessageDialog(ta, ”提交成功 ,null, JOp
60、tionPane.INFORMTION_MESSAG;a.addActionListener(al); p2.add(ta); p2.setBackground(Color.yellow);frame.setContentPane(p2); frame.pack; frame.setVisibl(tru;else if(e。getActionCommand()=”102 n 單人間”)ta.setText(”)JFrame frame=new JFrame(”檢查信息);JPanel p2=newJPanel();Container cp=frame.getContentPane();ta。a
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 智能制造系統(tǒng)開發(fā)補充條款
- 固態(tài)電池生產(chǎn)線建設項目股權投資及管理協(xié)議
- 新型城鎮(zhèn)化項目招商運營代理服務協(xié)議
- 智能制造系統(tǒng)質量與安全控制措施
- 數(shù)學課堂德育活動設計計劃
- 2025年春季少先隊領導力培養(yǎng)計劃
- 2025年金剛石膜熱沉材料項目立項申請報告模板
- 2025年云母增強塑料項目申請報告模板
- 醫(yī)藥行業(yè)成品保護措施的合規(guī)要求
- 環(huán)境藝術設計專業(yè)實習報告范文
- 小學心理健康教育家長會
- 2025屆山西省呂梁市高三第三次模擬考試英語試題(原卷版+解析版)
- 數(shù)字與圖像處理-終結性考核-國開(SC)-參考資料
- 建筑中級職稱《建筑工程管理》歷年考試真題題庫(含答案)
- 國民經(jīng)濟行業(yè)分類代碼表
- 拘留所教育課件02
- 深圳城市更新工改工專題研究報告
- 腦力工作負荷
- 大宇資本結構的神話
- that-girl中英文歌詞分享
- 重慶市新建居民住宅小區(qū)供配電設施建設管理辦法
評論
0/150
提交評論