面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼_第1頁
面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼_第2頁
面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼_第3頁
面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼_第4頁
面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼_第5頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼13/13面向?qū)ο笳n程設(shè)計java大作業(yè)報告含源代碼Java程序設(shè)計報告年級專業(yè)信息管理與信息系統(tǒng)學(xué)號學(xué)生姓名指導(dǎo)教師二一四年六月一、所用到的表的構(gòu)造及數(shù)據(jù)種類customer顧客表表名customer顧客說明此表記錄顧客基本信息列名說明數(shù)據(jù)種類拘束cno顧客編號char(10)主碼cname顧客姓名char(10)cage年紀(jì)intcsex性別char(2)取值為男或女,默認(rèn)女ctelephone顧客聯(lián)系方式char(15)非空操作人員表表名操作人員說明此表記錄操作人員信息列名說明數(shù)據(jù)種類拘束用戶名用戶登錄名

2、nchar(10)主碼密碼登錄密碼nchar(3)非空職位擔(dān)當(dāng)職務(wù)nchar(10)二、程序的功能及實現(xiàn)結(jié)果截圖1、登錄功能翻開Java文件運轉(zhuǎn)后輸入錯誤的用戶名后出現(xiàn):輸入用戶名Lucy密碼:123點擊登錄進(jìn)入操作界面:2、增添功能下拉顧客信息系統(tǒng)菜單,選擇增添客戶信息增添信息前數(shù)據(jù)庫客戶表的內(nèi)容:沒有編號0000013增添客戶0000013:數(shù)據(jù)庫內(nèi)表變成:注:0000015號是截圖以前增添進(jìn)去的3、查問功能下拉客戶信息系統(tǒng)菜單,選擇查問客戶信息,輸入客戶編碼0000013后點擊確立查問此顧客:4、改正功能下拉菜單客戶信息系統(tǒng),選擇改正客戶信息,從頭輸入相應(yīng)的正確信息,將錯誤的覆蓋掉,此處

3、將0000013張薔年紀(jì)改為32:數(shù)據(jù)庫表內(nèi)內(nèi)容:5、刪除功能下拉菜單客戶信息系統(tǒng),選擇刪除客戶信息,輸入客戶編碼數(shù)據(jù)庫信息變成:0000013號信息已經(jīng)刪除0000013點擊確認(rèn):6、退出系統(tǒng)功能下拉菜單客戶信息管理選擇退出:而后就退出了界面。三、程序源代碼packageLoginSystem;import.*;import.*;import.*;import.*;quals(pwds)(null,用戶名或密碼錯誤!,錯誤,;elsenewGoods();dispose();(con);(state);(rs);catch(SQLExceptione)(null,用戶名或密碼錯誤!,錯誤,;

4、);publicstaticvoidcloseConn(Connectionconn)tryif(conn!=null)();catch(SQLExceptione)();publicstaticvoidcloseState(Statementstate)tryif(state!=null)();catch(SQLExceptione)();publicstaticvoidcloseRs(ResultSetrs)tryif(rs!=null)();catch(SQLExceptione)();連結(jié)數(shù)據(jù)庫publicstaticConnectiongetConnection()Stringuse

5、rName=sa;StringuserPwd=123;Connectionconn=null;try(driverName);conn=(dbURL,userName,userPwd);catch(Exceptione)();returnconn;菜單界面classGoodsprivatestaticfinallongserialVersionUID=1L;staticfinalintWIDTH=760;staticfinalintHEIGHT=510;JPopupMenupop;JMenuItemitem2;JFramef;JMenuItemitem1;JPanelp;JTabbedPane

6、tp;publicGoods()f=newJFrame(夢之路時髦天堂商品管理系統(tǒng));JMenuBarmenubar1=newJMenuBar();tp=newJTabbedPane();p=newJPanel();(menubar1);(p);(tp);JMenumenu1=newJMenu(顧客信息系統(tǒng));(Z);(menu1);JMenuItemitem1=newJMenuItem(增添客戶信息);JMenuItemitem2=newJMenuItem(改正客戶信息);JMenuItemitem3=newJMenuItem(查問客戶信息);JMenuItemitem4=newJMenuI

7、tem(刪除客戶信息);JMenuItemitem5=newJMenuItem(退出);(item1);(item2);(item3);(item4);(item5);(p);JLabellb=newJLabel(newImageIcon();(lb);(true);(WIDTH,HEIGHT);Toolkitkit=();DimensionscreenSize=();intwidth=;intheight=;intx=(width-WIDTH)/2;inty=(height-HEIGHT)/2;(x,y);(newActionListener()publicvoidactionPerform

8、ed(ActionEventEvent)Addcon1=newAdd();(增添客戶信息,con1);(0,true);(0,增添客戶信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEventEvent)Updatecon2=newUpdate();(改正客戶信息,con2);(0,true);(0,改正客戶信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEventEv

9、ent)Selectcon3=newSelect();(查問客戶信息,con3);(0,true);(0,查問客戶信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEventEvent)Delectcon4=newDelect();(刪除客戶信息,con4);(0,true);(0,刪除客戶信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEvente)(0););(new

10、MenuListener()publicvoidmenuSelected(MenuEventevent)(!();publicvoidmenuDeselected(MenuEventevent)publicvoidmenuCanceled(MenuEventevent);/信息增添classAddextendsJPanelpublicvoidadd(Componentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,constraints);Add()GridBagLayoutlay=newGridBag

11、Layout();setLayout(lay);JButtonok=newJButton(確立);JButtonclear=newJButton(清空);JButtonc=newJButton(封閉);JLabelname=newJLabel(姓名);JLabelphone=newJLabel(電話號碼);JLabelsex=newJLabel(性別);JLabelnum=newJLabel(客戶編碼);JLabelyears=newJLabel(年紀(jì));Fontfont=newFont(Serief,22);finalJTextFieldnameinput=newJTextField(10)

12、;finalJTextFieldphoneinput=newJTextField(10);finalJTextFieldsexinput=newJTextField(10);finalJTextFieldnuminput=newJTextField(10);finalJTextFieldyearsinput=newJTextField(10);JLabeltitle=newJLabel(顧客基本信息);(font);JButtonadditionbutton=newJButton(增添);GridBagConstraintsconstraints=newGridBagConstraints()

13、;=;=4;=7;add(title,constraints,0,0,4,1);add(num,constraints,0,4,1,1);add(name,constraints,0,1,1,1);add(phone,constraints,0,5,1,1);add(sex,constraints,0,3,1,1);add(years,constraints,0,2,1,1);add(nameinput,constraints,1,1,1,1);add(phoneinput,constraints,1,5,1,1);add(sexinput,constraints,1,3,1,1);add(n

14、uminput,constraints,1,4,1,1);add(yearsinput,constraints,1,2,1,1);add(ok,constraints,3,1,1,1);add(clear,constraints,3,3,1,1);add(c,constraints,3,5,1,1);(newActionListener()publicvoidactionPerformed(ActionEventEvent)removeAll(););(newActionListener()publicvoidactionPerformed(ActionEventEvent)trycatch(

15、ClassNotFoundExceptionex)Stringuser=sa;Stringpassword=123;Statementstmt;ResultSetrs;PreparedStatementprestmt;Stringnametext=();Stringphonetext=();Stringsextext=();Stringnumtext=();Stringyearstext=();tryConnectioncon=(url,user,password);prestmt=(INSERTINTOcustomer顧客VALUES(?,?,?,?,?);(5,phonetext);(2,

16、nametext);(4,sextext);(1,numtext);(3,yearstext);();();(null,信息增添成功,OK,;catch(SQLExceptionex);(newActionListener()publicvoidactionPerformed(ActionEventEvent)();();();();(););/信息改正classUpdateextendsJPanelpublicvoidadd(Componentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,const

17、raints);Update()GridBagLayoutlay=newGridBagLayout();setLayout(lay);JButtonok=newJButton(確立);JButtonclear=newJButton(清空);JButtonc=newJButton(封閉);JLabelname=newJLabel(姓名);JLabelphone=newJLabel(電話號碼);JLabelsex=newJLabel(性別);JLabelnum=newJLabel(客戶編碼);JLabelyears=newJLabel(年紀(jì));finalJTextFieldnameinput=ne

18、wJTextField(10);finalJTextFieldphoneinput=newJTextField(10);finalJTextFieldsexinput=newJTextField(10);finalJTextFieldnuminput=newJTextField(10);finalJTextFieldyearsinput=newJTextField(10);JLabeltitle=newJLabel(改正基本信息);Fontfont=newFont(Serief,22);(font);/設(shè)置標(biāo)簽前風(fēng)景JButtonadditionbutton=newJButton(增添);Gr

19、idBagConstraintsconstraints=newGridBagConstraints();=;=4;=7;add(title,constraints,0,0,4,1);add(name,constraints,0,1,1,1);add(phone,constraints,0,5,1,1);add(sex,constraints,0,3,1,1);add(num,constraints,0,4,1,1);add(nameinput,constraints,1,1,1,1);add(phoneinput,constraints,1,5,1,1);add(sexinput,constr

20、aints,1,3,1,1);add(numinput,constraints,1,4,1,1);add(years,constraints,0,2,1,1);add(yearsinput,constraints,1,2,1,1);add(ok,constraints,3,1,1,1);add(clear,constraints,3,3,1,1);add(c,constraints,3,5,1,1);(newActionListener()publicvoidactionPerformed(ActionEvente)removeAll(););(newActionListener()publi

21、cvoidactionPerformed(ActionEventEvent)trycatch(ClassNotFoundExceptionex)Stringuser=sa;Stringpassword=123;Statementstmt;ResultSetrs;PreparedStatementprestmt;Stringnametext=();Stringphonetext=();Stringsextext=();Stringnumtext=();Stringyearstext=();tryConnectionconn=(url,user,password);prestmt=(updatec

22、ustomer顧客setcname=?,csex=?,ctelephone=?,cage=?WHEREcno=?);(1,nametext);(2,sextext);(5,numtext);(4,yearstext);(3,phonetext);();();();(null,信息改正成功,OK,;catch(SQLExceptionex)(););(newActionListener()publicvoidactionPerformed(ActionEventEvent)();();();();(););信息刪除classDelectextendsJPanelpublicvoidadd(Com

23、ponentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,constraints);Delect()GridBagLayoutlay=newGridBagLayout();setLayout(lay);JButtonok=newJButton(確立刪除此顧客!);JButtonclear=newJButton(清空);JLabelc=newJLabel(客戶編碼);Fontfont=newFont(Serief,22);(font);/設(shè)置標(biāo)簽前風(fēng)景finalJTextFieldd=newJTextF

24、ield(16);JLabeltitle=newJLabel(辨別信息);JButtonadditionbutton=newJButton(增添);GridBagConstraintsconstraints=newGridBagConstraints();=;=4;=6;add(c,constraints,0,1,1,1);add(d,constraints,1,1,1,1);add(ok,constraints,0,2,1,1);add(clear,constraints,1,2,1,1);(newActionListener()publicvoidactionPerformed(Actio

25、nEventEvent)trycatch(ClassNotFoundExceptionex)Stringuser=sa;Stringpassword=123;Statementstmt;ResultSetrs;PreparedStatementprestmt;tryConnectionconn=(url,user,password);prestmt=(DELETEFROMcustomer顧客WHEREcno=?);(1,();();();();(null,該顧客記錄已刪除,OK,;catch(SQLExceptionex);(newActionListener()publicvoidactio

26、nPerformed(ActionEventEvent)(););顧客信息查問classSelectextendsJPanelpublicvoidadd(Componentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,constraints);Select()GridBagLayoutlay=newGridBagLayout();setLayout(lay);JButtonok=newJButton(確立查問此顧客);JButtonclear=newJButton(清JLabelc=newJLabel

27、(客戶編碼);空);finalJTextFieldd=newJTextField(16);JLabeltitle=newJLabel(辨別信息);JButtonadditionbutton=newJButton(增添);JLabelname=newJLabel(姓名);JLabelid=newJLabel(客戶編碼);JLabelsex=newJLabel(性別);JLabelnum=newJLabel(電話號碼);JLabelyears=newJLabel(年紀(jì));finalJTextFieldnameinput=newJTextField(10);finalJTextFieldidinput=newJTextField(10);finalJTextFieldsexinput=newJTextField(10);finalJTextFieldnuminput=newJTextField(10);finalJTextFieldyearsinput=newJTextField(10);GridBagConstraintsconstraints=newGridBagConstrai

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論