第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Java,哪位幫忙解決一下

Java,哪位幫忙解決一下

儚三姩 2017-04-16 16:05:03
題目如圖,代碼都在下面窗體代碼:import?javax.swing.*; import?java.awt.*; import?java.awt.event.*; public?class?CustomerFrame?extends?JFrame?{ ????private?JLabel?labCustomerID; ????private?JLabel?labName; ????private?JLabel?labAdress; ????private?JTextField?txtCustomerID; ????private?JTextField?txtName; ????private?JTextField?textAdress; ????private?JButton??btnFirst; ????private?JButton??btnNext; ????private?JButton??btnPrior; ????private?JButton??btnLast; ????private?JButton??btnUpdate; ????private?JButton??btnAdd; ????private?JButton??btnDelete; ??//----------------------------------------------------------------------------------------------------- ????public?CustomerFrame()?{ ????????createComponents(); ????????layoutComponents(); ????????w(); ?????????setTitle("地址簿"); ?????????setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ?????????pack(); ????????????} ??//----------------------------------------------------------------------------------------------------- ????private?void?createComponents()?{?? ??????????labCustomerID=new?JLabel("雇員ID"); ??????????labName=new?JLabel("姓名??"); ??????????labAdress?=new?JLabel?("地址??");? ?????????txtCustomerID=new?JTextField(15); ?????????txtName=new?JTextField(15); ?????????textAdress=new?JTextField(38);? ????????????btnFirst=new?JButton("第一條"); ????????????btnNext=new?JButton("下一條"); ????????????btnPrior=new?JButton("上一條"); ????????????btnLast=new?JButton("最后一條"); ????????????btnUpdate=new?JButton("修改"); ????????????btnAdd=new?JButton("添加"); ????????????btnDelete=new?JButton("刪除"); ???????}?? ??//-----------------------------------------------------------------------------------------------------??? ???????private?void?layoutComponents()?{??//布局 ??????????Container?c=this.getContentPane(); ??????????c.setLayout(new?GridLayout(4,?1)); ??????????JPanel?EmployeeIDPane=new?JPanel(new?FlowLayout(FlowLayout.LEFT)); ??????????EmployeeIDPane.add(labCustomerID); ??????????EmployeeIDPane.add(txtCustomerID); ??????????JPanel?NamePane=new?JPanel(new?FlowLayout(FlowLayout.LEFT)); ??????????NamePane.add(labName); ??????????NamePane.add(txtName); ??????????JPanel?AdressPane=new?JPanel(new?FlowLayout(FlowLayout.LEFT)); ??????????AdressPane.add(labAdress); ??????????AdressPane.add(textAdress); ??????????JPanel?btnPane=new?JPanel(new?FlowLayout()); ??????????btnPane.add(btnFirst); ??????????btnPane.add(btnNext); ??????????btnPane.add(btnPrior); ??????????btnPane.add(btnLast); ??????????btnPane.add(btnUpdate); ??????????btnPane.add(btnAdd); ??????????btnPane.add(btnDelete); ???????????c.add(EmployeeIDPane);? ???????????c.add(NamePane);? ???????????c.add(AdressPane);? ???????????c.add(btnPane); ??????} //-----------------------------------------------------------------------------------------------------??????? ??? private?class?btnFirst?implements?ActionListener?{ public?void?actionPerformed(ActionEvent?e)?{ CustomerDB?a=new?CustomerDB(); CustomerDB.GetFirstCustomer(); } } ? private?class?btnNext?implements?ActionListener?{ public?void?actionPerformed(ActionEvent?e)?{ CustomerDB?c=new?CustomerDB(); CustomerDB.GetNextCustomer(); } } ? private?class?btnPrior?implements?ActionListener?{ public?void?actionPerformed(ActionEvent?e)?{ CustomerDB?d=new?CustomerDB(); CustomerDB.GetPrevCustomer(); } } ? private?class?btnLast?implements?ActionListener?{ public?void?actionPerformed(ActionEvent?e)?{ CustomerDB?g=new?CustomerDB(); CustomerDB.GetLastCustomer(); } } ? private?class?btnUpdate?implements?ActionListener?{ public?void?actionPerformed(ActionEvent?e)?{ CustomerDB?f=new?CustomerDB(); txtCustomerID.setText(""); txtName.setText(""); textAdress.setText(""); } } ? private?class?btnAdd?implements?ActionListener?{ public?void?actionPerformed(ActionEvent?e)?{ Customer?b=new?Customer(); txtCustomerID.setText(""+b.getID()); txtName.setText(""+b.getName()); textAdress.setText(""+b.getAddress()); } } ?????? ? private?class?btnDelete?implements?ActionListener?{ public?void?actionPerformed(ActionEvent?e)?{ Customer?h=new?Customer(); CustomerDB.DeleteCustomer(h); } } ?//-----------------------------------------------------------------------------------------------------? private?void?w()?{ btnFirst?h1?=?new?btnFirst(); btnFirst.addActionListener(h1); ??btnNext?h2?=?new?btnNext(); ??btnNext.addActionListener(h2); ?? ??btnAdd?h3?=?new?btnAdd(); ??btnAdd.addActionListener(h3); ?? ??btnUpdate?h4?=?new?btnUpdate(); ??btnUpdate.addActionListener(h4); ?? ??btnDelete?h5?=?new?btnDelete(); ??btnDelete.addActionListener(h5); ?? ??btnPrior?h6?=?new?btnPrior(); ??btnPrior.addActionListener(h6); ?? ??btnLast?h7?=?new?btnLast(); ??btnLast.addActionListener(h7); } //----------------------------------------------------------------------------------------------------- ?????? ???????public?static?void?main(String[]?args)?{ ???????????JFrame.setDefaultLookAndFeelDecorated(true); ???????????CustomerFrame?frame=new?CustomerFrame(); ???????????frame.setVisible(true); ??????????} ?????? }這是地址簿的代碼:package?ch08; public?class?Customer?{ private?String?id?; ????private?String?name?; ????private?String?address?; ????public?Customer(){}; ????public?Customer(String?ID?,?String?Name?,?String?Adress){ ????????id?=?ID; ????????name?=?Name; ????????address?=Adress; ????} ????public?String?getID()?{ ??????return?id; ????} ????public?void?SetID(String?ID){ ??????id=?ID; ????} ????public?String?getName()?{ ????????????return?name; ????} ????public?void?SetName(String?Name){ ????????????name?=?Name; ????} ????public?String?getAddress()?{ ????????????return?address; ????} ????public?void?SetAddress(?String?Address){ ????????????address?=?Address; ????} } ? //-------------------------------------------------------------------------------------------------------------? package?ch08; import?java.util.ArrayList; public?class?CustomerDB?{ private?static?ArrayList?CustomerList??=?new?ArrayList(); ?private?static?int??i??=?0; ????public?static?void?AddCustomer(?Customer?aCustomer){ ????????CustomerList.add(aCustomer); ????} ????public?static?void?DeleteCustomer(Customer?aC){ ????????for(int?i?=?0;?i<?CustomerList.size();i++){ ????????????Customer?aCustomer?=?(Customer)CustomerList.get(i); ????????????if?(aC.getID().equals(aCustomer.getID()))?{ ????????????????CustomerList.remove(i); ????????????????break; ????????????} ????????} ????} ????public?static?Customer?GetNextCustomer()?{ ????????if?(i?<?CustomerList.size()?-?1?) ????????????i?=?i?+?1; ????????return?(Customer)CustomerList.get(i);? ????} ????public?static?Customer?GetPrevCustomer()?{ ????????if?(i?>?0?) ????????????i?=?i?-?1; ????????return?(Customer)CustomerList.get(i); ????} ????public?static?Customer?GetFirstCustomer()?{ ????????i?=?0; ????????return?(Customer)CustomerList.get(i); ????} ????public?static?Customer?GetLastCustomer(){ ????????i?=?CustomerList.size()?-?1; ????????return?(Customer)CustomerList.get(i); ????} }按了按鈕總是報(bào)錯(cuò),我已經(jīng)混亂了,求大神指點(diǎn),
查看完整描述

1 回答

  • 1 回答
  • 1 關(guān)注
  • 1125 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)