企业业务开发实践项目报告_第1页
企业业务开发实践项目报告_第2页
企业业务开发实践项目报告_第3页
企业业务开发实践项目报告_第4页
企业业务开发实践项目报告_第5页
已阅读5页,还剩93页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、PAGE 大 连 东 软软 信 息 学学 院企业业务务开发实实践实验报告告系 别: 信信息管理理系 专业班级级: 信息 学 号: 1151 学生姓名名: 指导教师师: 张张奇松 20155年 8月 177 日 企业业务开发实践一、GUUI基础础知识习习题1.图形形界面1.1实实验目的的学习GUUI,主主要是SSwinng程序序设计,包括常常用窗体体,标签签组件和和图表,常用布布局管理理器,常常用面板板,按钮钮组件,文本组组件以及及事件监监听器等等。1.2实实验代码码及运行行结果(运行结结果截图图)1.创建建一个窗窗体,布布局如图图所示,窗体大大小为3300,2000setBBounnds(10

2、00, 1100, 3000, 2000);coonteentPPanee = neww JPPaneel();coonteentPPanee.seetBoordeer(nnew EmpptyBBordder(5, 5, 5, 5);coonteentPPanee.seetLaayouut(nnew BorrderrLayyoutt(0, 0);seetCoonteentPPanee(coonteentPPanee);JLLabeel llblsswinng = neew JJLabbel(uu4F660uu5977DuuFF00CSwwingg);coonteentPPanee.addd(l

3、lblsswinng, BorrderrLayyoutt.WEEST);2.创建建一个窗窗体,布布局如图图所示,窗体大大小为2200,1200conttenttPanne = neew JJPannel();coonteentPPanee.seetBoordeer(nnew EmpptyBBordder(5, 5, 5, 5);seetCoonteentPPanee(coonteentPPanee);coonteentPPanee.seetLaayouut(nnulll);JBButtton btnnNewwButttonn = neww JBButtton(uu5DEE6);bttnNeew

4、Buuttoon.aaddAActiionLListteneer(nnew ActtionnLisstenner() ppubllic voiid aactiionPPerfformmed(ActtionnEveent e) bttnNeewBuuttoon.ssetBBounnds(31, 688, 771, 38);coonteentPPanee.addd(bbtnNNewBButtton);JBButtton btnnNewwButttonn_1 = nnew JBuuttoon(u44E2DDu995F44);bttnNeewBuuttoon_11.seetBooundds(1135,

5、 688, 884, 38);coonteentPPanee.addd(bbtnNNewBButtton_1);JBButtton btnnNewwButttonn_2 = nnew JBuuttoon(u553F33);bttnNeewBuuttoon_22.seetBooundds(2255, 688, 661, 38);coonteentPPanee.addd(bbtnNNewBButtton_2);JCChecckBoox cchecckBoox = neew JJCheeckBBox(uu5DEE6);chheckkBoxx.seetBooundds(331, 1611, 771,

6、23);coonteentPPanee.addd(cchecckBoox);JCChecckBoox cchecckBoox_11 = neww JCChecckBoox(u553F33);chheckkBoxx_1.settBouundss(1000, 1611, 880, 23);coonteentPPanee.addd(cchecckBoox_11);JRRadiioBuuttoon rradiioBuuttoon = neew JJRaddioBButtton(uu5DEE6);raadiooButttonn.seetBooundds(1182, 1661, 83, 233);coon

7、teentPPanee.addd(rradiioBuuttoon);JRRadiioBuuttoon rradiioBuuttoon_11 = neww JRRadiioBuuttoon(u553F33);raadiooButttonn_1.settBouundss(2667, 1611, 884, 23);conntenntPaane.addd(raadiooButttonn_1);3. 创创建一个个窗体,布局如图图所示,窗体大大小为3300,1200setTTitlle(u77EFCCu554088u44F8BBu77A0BB);seetDeefauultCClosseOpperaatio

8、on(JJFraame.EXIIT_OON_CCLOSSE);seetBooundds(1100, 1000, 3000, 1120);coonteentPPanee = neww JPPaneel();coonteentPPanee.settBorrderr(neew EEmpttyBoordeer(55, 55, 55, 55);seetCoonteentPPanee(coonteentPPanee);coonteentPPanee.seetLaayouut(nnulll);JLListt liist_1 = neew JLiist();liist_1.ssetBBounnds(2511,

9、 1114, 299, -17);coonteentPPanee.addd(llistt_1);JCCombboBoox ccombboBoox = neew JCoombooBoxx();coombooBoxx.seetMoodell(neew DDefaaulttCommboBBoxMModeel(nnew Strringg u90009u98879u4EE00, u90009u98879u4EE8C, u90009u98879u4EE09);coombooBoxx.seetBooundds(223, 22, 655, 228);coonteentPPanee.addd(ccombboBo

10、ox);JLListt liist = nnew JLiist();liist.settModdel(neww AbbstrracttLisstMoodell() SStriing vvaluues = nnew Strringg u90009u98879u4EE00, u90009u98879u4EE8C, u90009u98879u4EE09;ppubllic intt geetSiize() retturnn valluess.lenngthh;ppubllic Objjectt geetEllemeentAAt(iint inddex) retturnn valluessinndexx

11、;);liist.settBouundss(988, 110, 50, 611);coonteentPPanee.addd(llistt);JLListt liist_3 = neew JLiist();liist_3.ssetBBounnds(2799, 333, -9, 511);coonteentPPanee.addd(llistt_3);JLListt liist_2 = neew JLiist();liist_2.ssetBBounnds(3099, 1114, 1, 1);coonteentPPanee.addd(llistt_2);JSScroollPPanee sccrolll

12、Paane = nnew JSccrolllPaane();sccrolllPaane.settBouundss(1669, 6, 50, 611);coonteentPPanee.addd(sscroollPPanee);JTTexttAreea ttexttAreea = neew JJTexxtArrea();teextAAreaa.seetTeext(1rnn2rrn33rn4rnn5);sccrolllPaane.settVieewpoortVVieww(teextAAreaa);4. 创创建一个个登录界面面,布局局如图所所示,窗窗体大小小为300,2000setTTitlle(u7

13、767BBu55F555u7754CCu997622);seetDeefauultCClosseOpperaatioon(JJFraame.EXIIT_OON_CCLOSSE);seetBooundds(1100, 1000, 3000, 2200);coonteentPPanee = neww JPPaneel();coonteentPPanee.seetBoordeer(nnew EmpptyBBordder(5, 5, 5, 5);seetCoonteentPPanee(coonteentPPanee);coonteentPPanee.seetLaayouut(nnulll);JLLab

14、eel llabeel = neew JJLabbel(uu75228uu62337uu5400DuuFF11A);laabell.seetBooundds(221, 47, 544, 115);coonteentPPanee.addd(llabeel);JLLabeel llabeel_11 = neww JLLabeel(u55BC66u778011uFFF1AA);laabell_1.settBouundss(211, 772, 54, 155);coonteentPPanee.addd(llabeel_11);JTTexttAreea ttexttAreea = neew JJTexx

15、tArrea();teextAAreaa.seetBooundds(668, 43, 1004, 19);coonteentPPanee.addd(ttexttAreea);JTTexttAreea ttexttAreea_11 = neww JTTexttAreea();teextAAreaa_1.settBouundss(688, 772, 1044, 115);coonteentPPanee.addd(ttexttAreea_11);JBButtton butttonn = neww JBButtton(uu7677Buu5F555);buuttoon.ssetBBounnds(10,

16、1114, 93, 233);coonteentPPanee.addd(bbuttton);JBButtton butttonn_1 = nnew JBuuttoon(u991CDDu77F6EE);buuttoon_11.seetBooundds(1130, 1114, 93, 233);conttenttPanne.aadd(butttonn_1);5.创建建一个窗窗体,布布局如图图所示,窗体大大小为5500,3000setTTitlle(euu5FAAEuu8FDDBuu95000uu5B558uu7BAA1uu74006uu7CFFBuu7EDDF);seetDeefauultCClo

17、sseOpperaatioon(JJFraame.EXIIT_OON_CCLOSSE);seetBooundds(1100, 1000, 5000, 3300);JMMenuuBarr meenuBBar = nnew JMeenuBBar();seetJMMenuuBarr(meenuBBar);JMMenuu meenu = neew JJMennu(u665877u44EF66);meenuBBar.addd(meenu);JMMenuuIteem mmenuuIteem = neew JJMennuIttem(uu65BB0uu5EFFA);meenu.addd(meenuIItemm

18、);JMMenuuIteem mmenuuIteem_11 = neww JMMenuuIteem(u662533u55F000);meenu.addd(meenuIItemm_1);JMMenuuIteem mmenuuIteem_22 = neww JMMenuuIteem(u44FDDDu55B588);meenu.addd(meenuIItemm_2);JMMenuuIteem mmenuuIteem_33 = neww JMMenuuIteem(u990000u551FAA);meenu.addd(meenuIItemm_3);JMMenuu meenu_1 = neew JJMen

19、nu(u555466u554C11u77BA11u774066);meenuBBar.addd(meenu_1);JMMenuuIteem mmntmmNewwMennuIttem = nnew JMeenuIItemm(u55546u544C1u677E5u8BBE2);meenu_1.aadd(mnttmNeewMeenuIItemm);JMMenuuIteem mmenuuIteem_44 = neww JMMenuuIteem(u555466u554C11u66DFBBu552A00);meenu_1.aadd(mennuIttem_4);JMMenuuIteem mmntmmNeww

20、MennuIttem_1 = neew JJMennuIttem(uu55446uu54CC1uu4FEEEuu65339);meenu_1.aadd(mnttmNeewMeenuIItemm_1);JMMenuuIteem mmenuuIteem_55 = neww JMMenuuIteem(u555466u554C11u552200u996644);meenu_1.aadd(mennuIttem_5);JMMenuu meenu_2 = neew JJMennu(u44F9BBu55E944u555466);meenuBBar.addd(meenu_2);JMMenuuIteem mmen

21、uuIteem_66 = neww JMMenuuIteem(u77F166u88F911u44F9BBu55E944u555466);meenu_2.aadd(mennuIttem_6);JMMenuu meenu_3 = neew JJMennu(u775288u662377);meenuBBar.addd(meenu_3);JMMenuuIteem mmenuuIteem_77 = neww JMMenuuIteem(u77F166u88F911u775288u662377);meenu_3.aadd(mennuIttem_7);coonteentPPanee = neww JPPane

22、el();coonteentPPanee.seetBoordeer(nnew EmpptyBBordder(5, 5, 5, 5);coonteentPPanee.seetLaayouut(nnew BorrderrLayyoutt(0, 0);seetCoonteentPPanee(coonteentPPanee);2.Jaava基基础知识识回顾2.1实实验目的的回顾Jaava基基础知识识,包括括基本数数据类型型,流程程控制,字符串串,类和和对象等等基础知知识。2.2实实验代码码及运行行结果(运行结结果截图图)1.进行行下列变变量说明明:初始值值为0的的intt变量;初始值值为10000的的

23、lonng变量量;初始值值为3.4的ffloaat变量量;初始值值为344.455的dooublle变量量;初始值值为4的的chaar变量量;初始值值为trrue的的boooleaan变量量;pacckagge ffisttswiing;publlic claass helllowwordd pubblicc staaticc voiid mmainn(Sttrinng arrgs) / TOODO 自动生生成的方方法存根根int a=0;longg b=10000;floaat c=3.4f;doubble d=344.455;charr e=4;boolleann f=truue;2.考虑

24、虑下面的的语句,这些语语句正确确吗?bytte aa = 1000;lonng bb = a*33+4;douublee c = aa*3.1+bb/2;intt x = bb; lonng bb = x;byteea=1100;loongb=a*3+44;ddoubblec=a*3.11+b/2;inttx=bb;lonngbb=x;3.设有有以下分分段函数数:编写一程程序,输输入自变变量x的值,输出函函数y的值。利用多分分支iff语句的的方法编编写程序序。packkagee fiistsswinng;impoort javva.uutill.Sccannner;publlic claass

25、 a08816 pubblicc staaticc voiid mmainn(Sttrinng arrgs) / TOODO 自动生生成的方方法存根根Scannnerr Nuumbeer=neww Sccannner(Sysstemm.inn);int a=NNumbber.nexxtInnt();int y;if(aa0)Sysstemm.ouut.pprinntlnn(y=1);if(aa=00)Sysstemm.ouut.pprinntlnn(y=0);if(aa0)Sysstemm.ouut.pprinntlnn(y=1);elsee if(aa=00)Sysstemm.ouut.pp

26、rinntlnn(y=0);elseeSysstemm.ouut.pprinntlnn(y=0);4.输出出1000内所有有的奇数数。注:奇数就就是不能能被2整除的的数packkagee fiistsswinng;publlic claass abcc pubblicc staaticc voiid mmainn(Sttrinng arrgs) / TOODO 自动生生成的方方法存根根for(intt i=1;ii=1100;i+)if(i%22=11)Syysteem.oout.priint(i+ );5.在控控制台打打印出1100以以内所有有质数。packkagee fiistsswinn

27、g;publlic claass bbbb pubblicc staaticc voiid mmainn(Sttrinng arrgs) / TOODO 自动生生成的方方法存根根innt jj;foor(intt i=2;ii=1100;i+)jj=2;wwhille(ii%j!=0)j+;iif(jj=ii)Sysstemm.ouut.pprinntlnn(i);6.求解解满足112+22+32+i2=10000)bbreaak;Syysteem.oout.priint(i-11);7.请定定义一个个交通工工具(VVehiiclee)的类类,其中中有:属性:速速度 (speeed),体积积

28、(ssizee)等等等。方法:移移动 (movve(),设设置速度度(seetSppeedd(innt sspeeed)、设置置体积(settSizze(iint sizze),加速速speeedUUp(iint speeed),减速速speeedDDownn(innt sspeeed)等等等。最后在测测试类VVehiiclee中的mmainn()中中实例化化一个交交通工具具对象,并通过过方法给给它设置置speeed,sizze的值值,并且且打印出出来。另另外,调调用加速速,减速速的方法法对速度度进行改改变。packkagee fiistsswinng;publlic claass Vehhi

29、clle privvatee innt speeed;privvatee innt sizze;pubblicc intt geetSppeedd() retturnn speeed;publlic voiid ssetSSpeeed(iint speeed) thiis.speeed = sspeeed;publlic intt geetSiize() retturnn sizze;publlic voiid mmovee()Sysstemm.ouut.pprinntlnn(移移动了);publlic voiid ssetSSizee(innt ssizee) thiis.sizze = s

30、iize;pubblicc staaticc voiid mmainn(Sttrinng arrgs) / TOODO 自动生生成的方方法存根根Vehiiclee v=neww Veehiccle();v.seetSiize(20);v.seetSppeedd(600);v.moove();8.编写写一个抽抽象类-图形类类(Grraphhic),包含含一个求求图形面面积的抽抽象方法法(arrea())。编写图形形类的子子类三角形形类(TTriaanglle),属性包包括三角角形三条条边长,使用构构造方法法初始化化三条边边,编写写能够判判断三角角形是何何种三角角形(等等腰、等等边、直直角、普普通

31、)的的方法(kinnd())。编编写比较较三角形形大小的的方法(commparre()),利利用方法法重载,实现比比较2个个三角形形和3个个三角形形大小的的功能。重新实实现父类类的面积积方法。doubble p=(siddeA+siddeB+siddeC)/2.0; ddoubble areea=MMathh.sqqrt(p*(p-ssideeA)*(p-siddeB)*(pp-siideCC); SSysttem.outt.prrinttln(namme+面积是是:+areea);packkagee fiistsswinng;publlic absstraact claass Graaphi

32、ic publlic absstraact douublee arrea();packkagee fiistsswinng;publlic cllasss Trriannglee exxtennds Graaphiic douublee a,b,c; douublee areea; pubblicc Trriannglee(dooublle aa,dooublle bb, ddoubble c) thhis.a=a; thhis.b=b; thhis.c=c; pubblicc voiid kkindd()iff(a+bc&a+cb&b+ca)iif(a=b&b=c&c=a)Sysstemm.

33、ouut.pprinntlnn(该该三角形形为等边边三角形形) ;eelsee if(a=b|b=c|a=c)Sysstemm.ouut.pprinntlnn(该该三角形形为等腰腰三角形形) ; eelseeSSysttem.outt.prrinttln(不能能构成三三角形); pubblicc voiid ccompparee(Trriannglee t11,Trriannglee t22) dooublle aareaa1=tt1.aareaa(); dooublle aareaa2=tt2.aareaa(); iff(arrea11arrea22)SSysttem.outt.prrint

34、tln(第一一个三角角形大); ellse if(aareaa1=areea2)Syysteem.oout.priintlln(两两个三角角形一样样大); ellseSysstemm.ouut.pprinntlnn(第第二个三三角形大大); pubblicc staaticc voiid mmainn(Sttrinngarggs) Trriannglee t11=neew TTriaanglle(33,4,5); Trriannglee t22=neew TTriaanglle(33,3,4); t11.coompaare(t1, t22); dooublle aareaa1=tt1.aare

35、aa(); Syysteem.oout.prrinttln(areea1); OOverrriddepuubliic douublee arrea() / TTODOO 自动动生成的的方法存存根ddoubble p=(a+b+c)/22.0;aareaa=Maath.sqrrt(pp*(pp-a)*(p-bb)*(p-cc);rretuurn areea;9.创建建一个名名称为VVehiiclee的接口口,在接接口中添添加两个个方法sstarrt()和sttop()。在在两个名名称分别别为Biike和和Buss的类中中实现VVehiiclee接口。创建一一个名称称为innterrfacceTe

36、est的的类,在在intterffaceeTesst的mmainn()方方法中创创建Biike和和Buss对象,并访问问staart()和sstopp()方方法。packkagee fiistsswinng;impoort javva.uutill.Sccannner;publlic claass ddddd pubblicc staaticc voiid mmainn(Sttrinng arrgs) / TOODO 自动生生成的方方法存根根innt a=neww intt8;Sccannner Nummberr=neww Sccannner(Sysstemm.inn);foor(intt i

37、=0;ii=77;i+)ai=Nummberr.neextIInt();innt mmin=a00,mmax=a00,ssum=0,aavg=0;foor(intt i=0;iimaax)maxx=ai;iif(aaimiin)minn=ai;ssum=summ+ai;avvg=(summ-maax-mmin)/(aa.leengtth-22);Syysteem.oout.priint(avgg);10.共共有8个评审审打分,统计时时,去掉掉一个最最高分和和一个最最低分,其余66个分数数的平均均分为最最后得分分。编写写一个程程序显示示这个分分数。packkagee fiistsswinng;i

38、mpoort javva.uutill.Sccannner;publlic claass ddddd pubblicc staaticc voiid mmainn(Sttrinng arrgs) / TOODO 自动生生成的方方法存根根innt a=neww intt8;Sccannner Nummberr=neww Sccannner(Sysstemm.inn);foor(int ii=0;i=7;ii+)ai=Nummberr.neextIInt();innt mmin=a00,mmax=a00,ssum=0,aavg=0;foor(intt i=0;iimaax)maxx=ai;iif(

39、aai=25000(66)查询询EMPP表中薪薪水不等等于25500的的所有数数据SEELECCT*frromemppWHEEREsall!=225000(7)查查询EMMP表中中雇员编编号在77600079900之之间的所所有数据据SEELECCT*frromemppWHEEREemppno=76600anddemmpnoo=779000(8)模模糊查询询EMPP表中,员工名名中含有有“五”的员工工信息SSELEECT*ffrommemmpWHHEREEennameeLIIKE%五%(9)查询EEMP表表中雇员员姓名中中第二个个字是“三”的的雇员的的所有信信息SEELECCT*frromem

40、ppWHEEREenaameLIKKE_三%DELLETEEfrromdepptwhhereedeeptnno=110DEELETTEffrommemmpwhhereedeeptnno=110SEELECCTeemp.*,ddeptt.*froomeemp,depptwwherreeemp.depptnoo=deept.depptnoo (100)使用两表表连接,查询EEMP表表和DEPPT表中中的所有有信息seleect * ffromm deept joiin eemp on deppt.ddepttno =emmp.ddepttno(11)使用两表表连接,查询EEMP表表中部门门名称为为

41、“市场场部”的的所有雇雇员信息息seleect * ffromm deept joiin eemp on deppt.ddepttno =emmp.ddepttno wherre ddnamme =市市场部 (122)使用两表表连接,更新EEMP表表中所有有部门名名称为“市场部部”的员工工的工资资,在原原本的基基础上增增加2000updaateempp,deeptsettemmp.ssal=empp.saal+2200wheeredeppt.ddepttno=empp.deeptnnoaanddeppt.ddnamme=市场部部(13)在DEEPT中中删除部门门10,删除EEMP表表中部门门号

42、为10的所有有员工deleete froom ddeptt whheree dnnamee=550deleete ffromm emmp wwherre ddepttno=5002.使用用JDBBC完成成对MyySqll数据库库的连接接。3.使用用JDBBC技术术,完成成数据库库表Usser(id,namme,aage)的所有数数据查询询,并在在控制台台进行简单单的数据据显示。5.综合合实例练练习5.1实实验目的的综合使用用GUII图形用用户界面面、事件件处理、数据库库表操作作进行程程序编写写,完成成一个具体体功能的的数据库库表增删删改查的的操作。5.2实实验代码码及运行行结果(运行结结果截图

43、图)packkagee liiyaoo.evvbuyy;impoort javva.ssql.*;impoort javva.uutill.ArrrayyLisst;impoort javva.uutill.HaashMMap;impoort javva.uutill.Liist;impoort javva.uutill.Maap;publlic claass ConnnDBB priivatte sstattic Strringg dbbclaassnnamee=ccom.myssql.jdbbc.DDrivver; priivatte sstattic Strringg dbburll=j

44、jdbcc:myysqll:/loccalhhostt:33306/evbbuy; priivatte sstattic Strringg dbbuseer=rooot; priivatte sstattic Strringg dbbpwdd=11111111; pubblicc Coonneectiion gettConnnecctioon() tryy Claass.forrNamme(ddbcllasssnamme); Connnecctioon cconnn=DrriveerMaanagger.gettConnnecctioon(ddburrl, dbuuserr, ddbpwwd);

45、 reeturrn cconnn; caatchh(Exxcepptioon ee) Sysstemm.ouut.pprinntlnn(e); retturnn nuull; pubblicc ReesulltSeet ggetRResuult(Strringg sqql)trryCConnnecttionn coonn=thiis.ggetCConnnecttionn();SStattemeent stmmt=cconnn.crreatteSttateemennt();RResuultSSet re=stmmt.eexeccuteeQueery(sqll);rretuurn re;caatc

46、hh(Exxcepptioon ee)SSysttem.outt.prrinttln(geetReesullt+e.ttoSttrinng();rretuurn nulll;pubblicc boooleean exeecutteSqql(SStriing sqll)trryCConnnecttionn coonn=thiis.ggetCConnnecttionn();SStattemeent stmmt=cconnn.crreatteSttateemennt();sstmtt.exxecuuteUUpdaate(sqll);/mmitt();rretuurn truue;caatchh(Ex

47、xcepptioon ee)SSysttem.outt.prrinttln(exxecuuteSSql+ee.tooStrringg();rretuurn fallse;pubblicc sttatiic vvoidd maain(Strringg arggs) CoonnDDB cconnndb=neww CoonnDDB();/*RessulttSett rss=coonnddb.ggetRResuult(seelecct uuserr_idd,usser_pwdd,dppm_nnamee frrom useer,ddepaartmmentt whheree usser.useer_ddp

48、m=depparttmennt.ddpm_id);trry wwhille(rrs.nnextt()Sysstemm.ouut.pprinntlnn(rss.geetSttrinng(11); cattch (SQQLExxcepptioon ee) / TTODOO 自动动生成的的 caatchh 块ee.prrinttStaackTTracce();*/iff(coonnddb.eexeccuteeSqll(ddeleete froom uuserr whheree usser_id = a)SSysttem.outt.prrintt(11);eelseeSSysttem.outt.prr

49、intt(22); packkagee liiyaoo.evvbuyy;impoort javva.aawt.BorrderrLayyoutt;impoort javva.aawt.EveentQQueuue;impoort javvax.swiing.JFrramee;impoort javvax.swiing.JPaanell;impoort javvax.swiing.borrderr.EmmptyyBorrderr;impoort javvax.swiing.JLaabell;impoort javvax.swiing.JOpptioonPaane;impoort javvax.swi

50、ing.JTeextFFielld;impoort javvax.swiing.JPaasswworddFieeld;impoort javvax.swiing.JBuuttoon;impoort javva.aawt.eveent.ActtionnLisstenner;impoort javva.aawt.eveent.ActtionnEveent;impoort javva.aawt.eveent.MouuseAAdappterr;impoort javva.aawt.eveent.MouuseEEvennt;impoort javva.aawt.eveent.KeyyAdaapteer;

51、impoort javva.aawt.eveent.KeyyEveent;impoort javva.ssql.RessulttSett;impoort javva.ssql.SQLLExccepttionn;publlic claass Loggin exttendds JJFraame priivatte JJPannel conntenntPaane;priivatte JJTexxtFiieldd txxtUsserNNamee;priivatte JJPassswoordFFielld ttxtPPasssworrd;/* * Lauunchh thhe aappllicaatioo

52、n. */pubblicc sttatiic vvoidd maain(Strringg arggs) EvventtQueeue.invvokeeLatter(neww Ruunnaablee() ppubllic voiid rrun() tryy Loggin fraame = nnew Loggin();fraame.settVissiblle(ttruee); ccatcch (Exccepttionn e) e.pprinntSttackkTraace(););/* * Creeatee thhe fframme. */pubblicc Looginn() seetTiitlee(

53、u7667Bu5FF55u7554Cu97762);seetDeefauultCClosseOpperaatioon(JJFraame.EXIIT_OON_CCLOSSE);seetBooundds(1100, 1000, 3000, 1189);coonteentPPanee = neww JPPaneel();coonteentPPanee.seetBoordeer(nnew EmpptyBBordder(5, 5, 5, 5);seetCoonteentPPanee(coonteentPPanee);coonteentPPanee.seetLaayouut(nnulll);JLLabee

54、l llabeel = neew JJLabbel(uu75228uu62337uu5400D);laabell.seetBooundds(557, 40, 544, 115);coonteentPPanee.addd(llabeel);JLLabeel llabeel_11 = neww JLLabeel(u55BC66u778011);laabell_1.settBouundss(577, 777, 54, 155);coonteentPPanee.addd(llabeel_11);txxtUsserNNamee = neww JTTexttFieeld();txxtUsserNNamee

55、.seetBooundds(1121, 377, 996, 21);coonteentPPanee.addd(ttxtUUserrNamme);txxtUsserNNamee.seetCoolummns(10);txxtPaasswwordd = neww JPPasssworrdFiieldd();txxtPaasswwordd.seetBooundds(1121, 744, 996, 21);coonteentPPanee.addd(ttxtPPasssworrd);JBButtton btnnLoggin = nnew JBuuttoon(u7767BBu55F555);bttnLoog

56、inn.adddMoouseeLisstenner(neww MoouseeAdaapteer() Oveerriideppubllic voiid mmousseCllickked(MouuseEEvennt aarg00) Strringg usserIId=ttxtUUserrNamme.ggetTTextt();Strringg usserPPwd=neww Sttrinng(ttxtPPasssworrd.ggetPPasssworrd();ConnnDBB coonn=neww CoonnDDB();Strringg sqql=sellectt usser_pwdd frrom u

57、seer wwherre uuserr_idd=+usserIId+;RessulttSett rss=coonn.gettRessultt(sqql);tryy whiile(rs.nexxt() Sttrinng uuserrPwddCheeck=rs.gettStrringg(uuserr_pwwd).tooStrringg(); iff(usserPPwdCChecck.eequaals(useerPwwd) JOOptiionPPanee.shhowMMesssageeDiaalogg(nuull, 登登录成功功!); Looginn.thhis.dissposse(); Maain

58、FFramme mmf=nnew MaiinFrramee(); mff.seetViisibble(truue); eelsee JOOptiionPPanee.shhowMMesssageeDiaalogg(nuull, 登登录失败败!); txxtUsserNNamee.seetTeext(); txxtPaasswwordd.seetTeext(); ccatcch (SQLLExccepttionn e) / TODDO 自自动生成成的 ccatcch 块块Sysstemm.ouut.pprinntlnn(e.toSStriing(););bttnLooginn.seetBoound

59、ds(331, 1188, 993, 23);coonteentPPanee.addd(bbtnLLogiin);JBButtton btnnResset = nnew JBuuttoon(u991CDDu77F6EE);bttnReesett.adddAcctioonLiisteenerr(neew AActiionLListteneer() ppubllic voiid aactiionPPerfformmed(ActtionnEveent e) txttUseerNaame.settTexxt();txttPassswoord.settTexxt(););bttnReesett.seet

60、Booundds(1164, 1118, 93, 233);coonteentPPanee.addd(bbtnRReseet);packkagee liiyaoo.evvbuyy;impoort javva.aawt.BorrderrLayyoutt;impoort javva.aawt.EveentQQueuue;impoort javvax.swiing.JFrramee;impoort javvax.swiing.JPaanell;impoort javvax.swiing.borrderr.EmmptyyBorrderr;impoort javvax.swiing.tabble.Def

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论