freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于java的餐廳點菜系統(tǒng)(編輯修改稿)

2025-06-12 19:32 本頁面
 

【文章內(nèi)容簡介】 件按鈕 (this)。//為按鈕添加事件監(jiān)聽器對象 (b)。 //將此按鈕添加到中間容器 b = new JButton(退出系統(tǒng) )。//再創(chuàng)建一個按鈕 (this)。//為按鈕增加事件監(jiān)聽器 (b)。 //將按鈕添加到中間容器 (( (, 2), 歡迎光臨 , , ))。 //將中間容器添加到內(nèi)容面板 (buttonPanel, )。 ()。 (230, 230, 200, 200)。 (true)。 } public void actionPerformed(ActionEvent e) { String cmd = ()。 if ((進入系統(tǒng) )) { ()。 //關(guān)閉對話框 new Menu().setVisible(true)。 //創(chuàng)建 Frame窗口 } 16 if ((退出系統(tǒng) )) (0)。}} 主程序界面: public class Menu implements ActionListener, ItemListener { // 餐桌數(shù) public static final int COUNT = 5。 private JRadioButton[] r = new JRadioButton[COUNT]。 // 菜品總數(shù) public static final int NUMBER = 10。 private JRadioButton[] c = new JRadioButton[NUMBER]。 private JFrame f = null。 public void setVisible(boolean visible) { if (f != null) { (visible)。 //設(shè)置 Frame可見 } } public Menu() { //創(chuàng)建 JFrame并指定其窗口標(biāo)題 f = new JFrame(請選擇您想要的桌號和您喜歡的菜 )。 Container dialogPane = ()。//獲得其內(nèi)容面板 (new BorderLayout())。//為容器布局 ButtonGroup bg = new ButtonGroup()。 //按鈕組,可組合若干單選按鈕 ,同一時刻只能有一個按鈕被選中 JPanel p1 = new JPanel()。//創(chuàng)建一個無邊框中間容器 ()。//為容器設(shè)置背景顏色 (new GridLayout(1, 5))。//設(shè)置無邊框容器的布局管理 (( (, 4), 請選擇桌號 , , ))。 // 數(shù)組大小必須與 COUNT一致 String[] str = { 1, 2, 3, 4, 5 }。 //桌號 for (int i = 0。 i 。 i++) { r[i] = new JRadioButton(str[i])。 //新建一個單選框,并指明其文本說明標(biāo)簽 r[i].addItemListener(this)。 (r[i])。//將單選框加入中間容器 17 (r[i])。//將單選框加入按鈕組 } JPanel p2 = new JPanel()。//創(chuàng)建一個中間容器 (new GridLayout(5, 2))。//設(shè)置容器布局 ()。//設(shè)置容器布局 (( (, 4), 請選擇您喜歡的菜 , , ))。 // 數(shù)組大小必須與 NUMBER一致 String[] strname = { 球溪鰱魚 45元 /份 , 黑椒牛排 58元 /份 , 澳洲小龍蝦 36元 /份 , 秘制小肉丸 36元 /份 , 重慶辣子雞 30元 /份 , 尖椒臘肉 48元 /份 , 魚香土豆 15元 /份 , 燒豬蹄 55元 /份 , 生燜藕片 18元 /份 , 番茄菜花 25元 /份 }。 for (int i = 0。 i 。 i++) { c[i] = new JRadioButton(strname[i])。//新建一個單選框 c[i].addItemListener(this)。//監(jiān)聽單選框選中狀態(tài) (c[i])。//將單選框加入容器內(nèi) } JPanel p3 = new JPanel()。//新建一個容器 (new GridLayout(1, 2))。//設(shè)置布局 JButton button1 = new JButton(確 定 )。 ()。 JButton button2 = new JButton(結(jié) 帳 )。 ()。 JButton button3 = new JButton(取消 )。 ()。 //為按鈕增加事件監(jiān)聽器 (this)。 (this)。 (this)。 //將按扭加入容器 (button1)。 (button2)。 (button3)。 //將三個容器加入內(nèi)容面板,并布局 (p1, )。 (p2, )。 (p3, )。 ().setDefaultButton(button1)。 //設(shè)置窗體回車對應(yīng)按鈕 ()。 // 排版 (350, 350, 450, 450)。//設(shè)置窗體大小 18 //用標(biāo)題欄上的關(guān)閉按鈕關(guān)閉窗口 (new WindowAdapter() { public void windowClosing(WindowEvent evt) { //關(guān)閉窗口事件處理 (0)。 } })。 } private int op = 0。 // 代表幾號桌 private MenuInfo menu = new MenuInfo()。 public void clean(){ menu = new MenuInfo()。 for(int i=0。i 。 i++){ c[i].setSelected(false)。 } } //第幾號桌被選 public void itemStateChanged(ItemEvent e) { Object oj = ()。 for (int i = 0。 i 。 i++) { if (r[i] == oj) { op = i。 clean()。 break。} } for (int i = 0。 i 。 i++) { if (c[i] == oj) { (i)。//標(biāo)志哪道菜被點了 break。} } } public void actionPerformed(ActionEvent e) { String cmd = ()。 if ((確 定 )) { if (menu != null) {// 保存數(shù)據(jù) (op)。 } } else if ((結(jié) 帳 )) { 19 new jiezhang()。 } else if((取消 )){ try { ()。//裝載數(shù)據(jù)庫驅(qū)動程序 //建立一個數(shù)據(jù)庫連接 Connection con = (jdbc:odbc:jiudian, test, 1234)。 Statement stmt = ()。// 創(chuàng)建一個Statement對象 (delete from jiudian )。//向數(shù)據(jù)庫發(fā)送 SQL語句 —— 刪除記錄 }catch (Exception em) { } clean()。} }} public class MenuInfo { // 標(biāo)志哪道菜被點了? private boolean[] remark = new boolean[]。 // 每道菜對應(yīng)的價格 private int[] price = {45, 58, 36, 36,30,48,15,55,18,25}。 // 每道菜對應(yīng)的菜名 private String[] name = { 球溪鰱魚 , 黑椒牛排 , 澳洲小龍蝦 , 秘制小肉丸 ,重慶辣子雞 ,尖椒臘肉 ,魚香土豆 ,燒豬蹄 ,生燜藕片 ,番茄菜花}。 /*** * 如果菜名、價錢從數(shù)據(jù)庫中讀取請在此構(gòu)造函數(shù)中初始化 * */ public MenuInfo() { // 創(chuàng)建時默認(rèn)為 false for (int i = 0。 i 。 i++) remark[i] = false。 } /** * 標(biāo)志第幾道菜被點了 * */ public void setOrderMenu(int item) { // 點了的就取消 ,沒點的就點上 remark[item] = !remark[item]。 } /** 20 * 標(biāo)志第幾道菜被點了 * * @param item * 菜單索引值 * @param mark * false 沒點 true 已點 */ public void setOrderMenu(int item, boolean mark) { remark[item] = mark。 } /** * 按確定時保存數(shù)據(jù) * * @param item * 餐桌號 */ public void save(int item) { // 數(shù)據(jù)庫操作 try { //裝載數(shù)據(jù)庫驅(qū)動程 序 ()。 //建立一個數(shù)據(jù)庫連接 Connection con = (jdbc:odbc:jiudian, test, 1234)。 Statement stmt = ()。 //創(chuàng)建一個 Statement對象 String SQLOrder。//字符串變量,存放 SQL語句 // 保存點中的菜 for (int i = 0。 i 。 i++) { if (remark[i]) { //執(zhí)行 Insert語句 SQLOrder = Insert Into jiudian Values ( + item + ,39。+ name[i] + 39。, + price[i] + )。 (SQLOrder)。//向數(shù)據(jù)庫中寫入語句 } } // 關(guān)閉數(shù)據(jù)庫連接 ()。 ()。 } catch (Exception em) { } }} 21 結(jié)賬功能: public class jiezhang implements ActionListener { private JDialog Dialog。 private JLabel L1, L2, L3, L4, L5。 private JTextField F1 = new JTextField()。 public jiezhang() { Dialog = new JDialog()。 (結(jié)賬 )。 Container dialogPane = ()。 ()。 (new GridLayout(4, 2))。 L1 = new JLabel(請輸入您的桌號 , )。 L2 = new JLabel(您總共消費了: , )。 L4 = new JLabel(您總共點了: , )。 L3 = new JLabel( , )。 L5 = new JLabel( , )。 ()。 (L1)。 (F1)。 (L2)。 (L3)。 (L4)。 (L5)。 JButton b1 = new JButton(確定 )。 ()。 (b1)。 JButton b2 = new JButton(取消 )。 ()。 (b2)。 (this)。
點擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1