《JAVA数据库课程设计学生选课管理系统.docx》由会员分享,可在线阅读,更多相关《JAVA数据库课程设计学生选课管理系统.docx(27页珍藏版)》请在优知文库上搜索。
1、Sclstu学生查询界面:JPaiveIpCcntcr;Crd1.ayoutcard=null;J1.abellabel=nulkJMcnuBarmb=ncwJMcnuBarO;菜单栏JMcnuml:newJMenuT学生管理JMenuhemaddI=newJMenuhemCaddIJMcnuIlemupdatal=newJMenukem(Mupdatalm):JMcnuItemdelete!=ncwJMcnultcm(,dcletclw);JMcnum2=ncwJMcnu(课程管理”);JMenuhemadd2newJMenUhemCadd2);JMenuIlemupdala2=newJMe
2、nukem(updata2*):JMcnultcmddctc2=ncwJMcnultcmCdeIctc?*);JMcnum3ncwJMcnu(,选课管理”);JMenuliemadd3=newJMenuhein(Mad(J3):JMunuIlemupdula3=newJMenullem(updata3*):JMcnuItemdclctc3=ncwJMcnultcm(delete?):JMcnum4-ncwJMCml(,查询管理。;JMenuItem学生杳询=newJMeIHIkem(杳询信息JMcnuIlemm5=newJMCmIhCmr系统退出)Eontt=ncwEont(,sancri.F
3、ont.P1.AlNJ2);publicMenu()IhiS.seEle(学生选课管理系统try(UIManager.sel1.okAndFecl(UIManagcr.ge(System1.kAndFeclClassName():)catch(Exceptionc)System.crr.prinUn(不能设置外观:+c):组合菜推addMenu1();addMenu2();addMcnu3():addMcnu4();AddJMenuBarO:sc(JMcnuBar(mb);Iabd=newJ1.abd1.选课管理系统F1.abc1.CENTER):Iabe1.SelFOm(newFolH宋体”
4、,FomBOUJ的Xlabel.se:点击事务add1.3ddAction1.iqCnC阳his);UpdataI.addAc(ion1.is(ener(this);delete1.addAclion1.istencr(Ihis):m5.addAction1.istcnerdhis);add2.addAction1.isicncrtchis);dele(e2,a(klAc(ion1.is(ener(ihis):updala2.addAclin1.istener(this);privatevoidaddMcnul()(n1.add(addI);ml.add(upiiataI);ml.add(dc
5、leccl);m1.sclFom(t);publicvoidac(ionPerforned(ActionEsen(e)Objectobj=e.getSouree():if(obj=m5)Systcmxxit(O):)ClSCHf(Obj=add1)CaIXtShOW(I)CCmer,增加学生界面”);else(if(obj=pdataI)(Car&shoW(PCetUerJ修改学生界面”);else(if(o=dek(el)(Card.shcnHpCcnkx”班|除学生界面):clscif(tky=add2)(card.show(pCcntcr.if?Jj11Vfflw);)clsc(ifto
6、bj=dclee2)(CardShOW(PCemer,删除课程界面*);else(if(Obj=UPdata2)cardshow(pCemer.,修改课程界面);)elsc(if(obj=i*dd3)(Canl.show(PeCnlCrJ阴加选课界面”):)clsc(if(objdc!ctc3)(card.show(pCcntcr.”盼除选谍界面clsc(if(obj=unH)IHpublicstaticvoidmain(StringJargs)(newMcnu();J添加数据时,若遇到必褥信息未填写、不能重复的信息在数据库中已存在.都会批示无法添加及其错误缘由.importjava.awt.
7、*;importjavax.swing.*;importjava.sql.*;importjavaawtevent*;publicclassAddCextendsJPaneli11lementsAction1.istenerIJTextField那号,课名;JButton录入;publicAddC)box5.add查找);BoxboH=Bo.createV0rticalBoO/boboH.addbol);boxH.addbox2);boxH.addbox3);boH.addbox4);boxH,建ddBoxczgatrgVerticd2G1ue);WKi.addAction1.istener(
8、this);S.addAction1.istener(this);JPanelPiCPanClhnoWJPanelO;JPanelmessPanel=nwJPanelO;messPaneladd(box5);picPanel.add(学号=nowJTextField(12);下面是java的源代码,总共有15个突。分别是AddCjava,AddSCjava,/KddstuJavarDclstu.javaDc)C.jiiva.DeISCjava.Menujava.SelCJava.SeISCjava.Selstujava.S(lcnt.java.UpdatastujavaUpdatcCjava.
9、UpdatcSC.java-Uscrjava”因为本人太懒.所以一些类名的错误没有修改,也没有优化系统,总之还兜足能运行的,数据陈用的是$32005,假如用别的数据即就要波驱动,详细自己上网百度吧。假如自己有空,优化一下还是很好滴AcMC.jaba:importjava.awus;importjavaxwing.*;importjava.sql*;inx)11java.aw(,eve11.5t;publicclassAddCextendsJPanclimplementsAction1.istcncr(JlcxtFicId课号,课名;JBuuon录入;publicAddC()try(UlMana
10、gcnset1.ookAndFccl(UlManagcrgetsysccm1.ookAndFeeIClassNameO);Jcach(ExcecwJTcxlFieId(IZ);录入=newJBlIUoIM录入);录入.addAc(ion1.欣nertlhis):Boxbox1=BcxQrcaicHorizongIBoxO;/横放boxBoxbox2=Box.crea(eHorizomalBox();Boxbox3=Box.creatcH(rizntalBox():Boxbox4=Box.crcatcHorizontalBoxO:boxI.add(newJ1.abdC课);box1.add(课号
11、Xbx2.add(newJ1.abd(课片:6:box2add(课名):box4add(录入);BoxboxH=Box.crea(eVe11icalBoxO,放boxboxH.add(boxl);boxH.add(box2);boxH.add(box3);boxH.add(box4);boxH.add(Box.crcateVerticaIGIucO);务器和数据库testStringUscrNamc三,*sa*;默认用户名SiringUserPwd=huangjiwei*:监码ConnectionJbCnn=null:IlyClass.forNane(driverNa11)e);dbConn=
12、DrivcrManager.gelCnnuprinlSlackT11d):)returndbConn;AddSCjava:imx)11java.aw(1*;importjavaxswing.:inx)11java.sql.;importjava.util.*;importjavaxwing.filcchscr.4:importjava.io.*;inx)11jaawi.eveni产;publicclassAddSCextendsJPancIimplementsAction1.istcncrIJIcxiFicId课号,学号,成果:JBunon录入;publicAddSC()try(UlManagccsct1.ookAndFceKuiManagcrgctSystem1.ookAndFcclCIassNamcO);Icach(Excexione)Sysiem.etr.rinUn(不能设巴外观:Qe);i=newJIcxtHcIdd2):学号=OCWJIcxtFicId(IZ);