版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
PAGE《Java應(yīng)?用開發(fā)》課程設(shè)計(jì)報(bào)?告題目:學(xué)生信息管?理系統(tǒng)指導(dǎo)老師:姓名:專業(yè):計(jì)算機(jī)科學(xué)?與技術(shù)班級(jí):日期:目錄TOC\o"1-2"\h\z\uHYPER?LINK一、系統(tǒng)總體設(shè)?計(jì) PAGER?EF_Toc3?28921?933\h1HYPER?LINK(一)設(shè)計(jì)目標(biāo)及?完成功能 PAGER?EF_Toc3?28921?934\h1HYPER?LINK(二)系統(tǒng)流程圖? PAGER?EF_Toc3?28921?935\h2HYPER?LINK二、詳細(xì)設(shè)計(jì) PAGER?EF_Toc3?28921?936\h3HYPER?LINK(二)系統(tǒng)設(shè)計(jì) PAGER?EF_Toc3?28921?937\h7HYPER?LINK(三)源代碼及技?術(shù) PAGER?EF_Toc3?28921?938\h10HYPER?LINK三、使用與測(cè)試? PAGER?EF_Toc3?28921?939\h20HYPER?LINK四、數(shù)據(jù)庫(kù)設(shè)計(jì)? PAGER?EF_Toc3?28921?940\h21HYPER?LINK總結(jié)(體會(huì)) PAGER?EF_Toc3?28921?941\h22HYPER?LINK參考文獻(xiàn) PAGER?EF_Toc3?28921?942\h23《Java應(yīng)?用開發(fā)》課程設(shè)計(jì)報(bào)?告PAGE2《Java語(yǔ)?言程序設(shè)計(jì)?》課程設(shè)計(jì)報(bào)?告PAGE\*MERGE?FORMA?T0一、系統(tǒng)總體設(shè)?計(jì)(一)設(shè)計(jì)目標(biāo)及?完成功能1、設(shè)計(jì)目標(biāo)學(xué)生信息管?理系統(tǒng)是學(xué)?校的一項(xiàng)重?要數(shù)據(jù)資源?,因而學(xué)生信?息管理必然?成為學(xué)校的?一項(xiàng)常規(guī)性?的重要工作?。加強(qiáng)學(xué)生信?息管理在單?純依靠以手?工管理的方?法,不僅需要耗?用大量的人?力、物力、財(cái)力,而且由于人?工管理存在?著大量的不?可控因素,造成了信息?管理的某些?不規(guī)范,工作效率低?,難以達(dá)到預(yù)?期的目的。為提高工作?效率、保證學(xué)校能?夠及時(shí)準(zhǔn)確?了解各學(xué)生?的各種信息?及學(xué)生總體?信息,開發(fā)學(xué)生信?息管理系統(tǒng)?。2、完成功能完成學(xué)生信?息的基本管?理。本系統(tǒng)分為?管理員和學(xué)?生管理兩部?分。管理員管理?項(xiàng)目如下:添加學(xué)生信?息、修改學(xué)生信?息、查詢學(xué)生信?息、刪除學(xué)生信?息;學(xué)生管理項(xiàng)?目如下:添加學(xué)生信?息、查詢學(xué)生信?息。(二)系統(tǒng)流程圖?登陸登陸登陸角色學(xué)生管理員添加學(xué)生信?息查詢學(xué)生信?息修改學(xué)生信?息查詢學(xué)生信?息刪除學(xué)生信?息添加學(xué)生信?息開始退出管理系?統(tǒng)菜單操作菜單操作二、詳細(xì)設(shè)計(jì)圖2-1登陸界面1?圖2-2登陸界面2?圖2-3系統(tǒng)主界面?圖2-4添加學(xué)生信?息界面圖2-5修改學(xué)生信?息界面圖2-6查詢學(xué)生信?息界面圖2-7刪除學(xué)生信?息界面圖2-8系統(tǒng)信息界?面圖2-9我的信息界?面(二)系統(tǒng)設(shè)計(jì)1、系統(tǒng)結(jié)構(gòu)圖?學(xué)生信息管學(xué)生信息管?理系統(tǒng)學(xué)生登陸管理員登陸?添加學(xué)生信?息查詢學(xué)生信?息添加學(xué)生信?息修改學(xué)生信?息查詢學(xué)生信?息刪除學(xué)生信?息2、類及功能列?表序號(hào)類名方法類功能說明?方法名功能1First?First?()構(gòu)造方法,構(gòu)造界面并?注冊(cè)事件美觀效果2Login?actio?nPerf?ormed?(actio?nEven?te)處理“登陸”按鈕的事件?實(shí)現(xiàn)登陸功?能Connc?tsql()連接數(shù)據(jù)庫(kù)?3Menuactio?nPerf?ormed?(actio?nEven?te)處理菜單按?鈕的事件主界面,實(shí)現(xiàn)管理員?操作功能Menu()構(gòu)造方法,構(gòu)造界面及?注冊(cè)事件4addFo?rmConnc?tsql()連接數(shù)據(jù)庫(kù)?管理員添加?學(xué)生信息actio?nPerf?ormed?(Actio?nEven?te)處理按鈕事?件5modif?yForm?Connc?tsql()連接數(shù)據(jù)庫(kù)?管理員修改?學(xué)習(xí)actio?nPerf?ormed?(Actio?nEven?tae)處理按鈕事?件6Serch?Connc?tsql()連接數(shù)據(jù)庫(kù)?管理員查詢?學(xué)生信息actio?nPerf?ormed?(Actio?nEven?te)處理按鈕事?件7delet?eForm?Connc?tsql()連接數(shù)據(jù)庫(kù)?管理員刪除?學(xué)生信息actio?nPerf?ormed?(Actio?nEven?tae)處理按鈕事?件8Menu2?actio?nPerf?ormed?(actio?nEven?te)處理菜單按?鈕的事件主界面,實(shí)現(xiàn)學(xué)生操?作功能Menu2?()構(gòu)造方法,構(gòu)造界面及?注冊(cè)事件9addFo?rm2Connc?tsql()連接數(shù)據(jù)庫(kù)?學(xué)生添加學(xué)?生信息actio?nPerf?ormed?(Actio?nEven?te)處理按鈕事?件10Serch?2Connc?tsql()連接數(shù)據(jù)庫(kù)?學(xué)生查詢學(xué)?生信息actio?nPerf?ormed?(Actio?nEven?te)處理按鈕事?件11About?meAbout?me()構(gòu)造方法,構(gòu)造界面幫助窗口,關(guān)于我12About?Syste?mAbout?Syste?m()構(gòu)造方法,構(gòu)造界面幫助窗口,關(guān)于系統(tǒng)(三)源代碼及技?術(shù)1、所有代碼-數(shù)據(jù)庫(kù)將以下圖片?以上圖名稱?存入ima?ges文件?夾目錄下。要自己將各?代碼新建為?.java格?式文件,放在與im?ages文?件夾同目錄?下。并將數(shù)據(jù)庫(kù)?附加到sq?lserv?er200?5,再不需要任?何改動(dòng)方可?運(yùn)行。①登陸界面1?impor?tjava.io.*;impor?tjava.awt.*;impor?tjavax?.swing?.*;impor?tjava.awt.event?.*;class?First?exten?dsJFram?eimple?ments?Mouse?Liste?ner{ priva?teJPane?lpanel?=(JPane?l)getCo?ntent?Pane(); priva?teJPane?lpanel?2=newJPane?l(); JLabe?ll1;publi?cFirst?(){ super?("學(xué)生信息管?理系統(tǒng)"); Image?Iconbackg?round?=newImage?Icon("image?s\\Login?.jpg");//整個(gè)背景圖?片 JLabe?lL=newJLabe?l(backg?round?); L.setBo?unds(0,0,500,400);//取整張圖片? panel?.setOp?aque(false?); panel?2.setOp?aque(false?); Image?Iconbutto?n=newImage?Icon("image?s\\T20.jpg"); l1=newJLabe?l(butto?n); panel?2.add(l1); panel?.add(panel?2); panel?.setLa?yout(null); panel?.add(L); panel?2.setBo?unds(118,258,300,100); //設(shè)置監(jiān)聽器? l1.addMo?useLi?stene?r(this); getLa?yered?Pane().setLa?yout(null); getLa?yered?Pane().add(L,newInteg?er(Integ?er.MIN_V?ALUE));setSi?ze(500,400);setVi?sible?(true);setRe?sizab?le(false?);setLo?catio?n(450,200);setDe?fault?Close?Opera?tion(JFram?e.EXIT_?ON_CL?OSE); }publi?cvoidmouse?Click?ed(Mouse?Event?e){ if((JLabe?l)e.getSo?urce()==l1) {this.dispo?se(); Login?d=newLogin?();} }publi?cvoidmouse?Exite?d(Mouse?Event?e){ if((JLabe?l)e.getSo?urce()==l1) { l1.setBa?ckgro?und(Color?.BLACK?); } }publi?cvoidmouse?Enter?ed(Mouse?Event?e){ if((JLabe?l)e.getSo?urce()==l1) {l1.setFo?regro?und(Color?.BLUE);} }publi?cvoidmouse?Relea?sed(Mouse?Event?e){ }publi?cvoidmouse?Press?ed(Mouse?Event?e){ }publi?cstati?cvoidmain(Strin?gargs[]){First?f=newFirst?();}}②登陸界面2?impor?tjava.io.*;impor?tjava.sql.*;impor?tjava.awt.*;impor?tjavax?.swing?.*;impor?tjava.awt.event?.*;publi?cclass?Login?exten?dsJFram?eimple?ments?Actio?nList?ener{Conne?ction?conn;//定義連接對(duì)?象State?mentstmt;//語(yǔ)句Resul?tSetrst;//結(jié)果集priva?teJLabe?llb1=newJLabe?l("帳號(hào):");priva?teJLabe?llb2=newJLabe?l("口令:");priva?teJLabe?llb3=newJLabe?l("學(xué)生信息管?理系統(tǒng)");priva?teJLabe?llb4=newJLabe?l("請(qǐng)選擇登陸?角色");priva?teTextF?ieldt1=newTextF?ield(15);priva?teTextF?ieldt2=newTextF?ield(15);priva?teJButt?onb1=newJButt?on("登陸");priva?teJButt?onb2=newJButt?on("取消");priva?teJComb?oBoxuser1?=newJComb?oBox();priva?teJPane?lp1=(JPane?l)getCo?ntent?Pane();priva?teJPane?lp2=newJPane?l();priva?teJPane?lp3=newJPane?l();priva?teJPane?lp4=newJPane?l();priva?teJPane?lp5=newJPane?l(); publi?cLogin?(){ setTi?tle("學(xué)生信息管?理系統(tǒng)"); setVi?sible?(true); setRe?sizab?le(false?); setLa?yout(null); user1?.addIt?em("管理員"); user1?.addIt?em("學(xué)生"); user1?.setFo?nt(newFont("華文行楷",Font.BOLD,14)); lb1.setFo?nt(newFont("華文行楷",Font.BOLD,14)); lb2.setFo?nt(newFont("華文行楷",Font.BOLD,14)); lb3.setFo?nt(newFont("華文行楷",Font.BOLD,35)); lb4.setFo?nt(newFont("華文行楷",Font.BOLD,14)); Image?Iconbackg?round?=newImage?Icon("image?s\\Login?2.jpg"); JLabe?lL=newJLabe?l(backg?round?);L.setBo?unds(0,0,500,400); p2.add(lb3);p5.add(lb4);p5.add(user1?);p3.add(lb1);p3.add(t1);p3.add(lb2);p3.add(t2);p4.add(b1); p4.add(b2); p1.setOp?aque(false?); p2.setOp?aque(false?); p3.setOp?aque(false?); p4.setOp?aque(false?); p5.setOp?aque(false?); t2.setEc?hoCha?r('*'); p1.setLa?yout(null); p1.add(L);//存放背景圖?片 p2.setBo?unds(90,44,350,100); p3.setBo?unds(155,160,210,60); p5.setBo?unds(132,100,250,40); p4.setBo?unds(150,250,300,100); //將所有pa?nel加到?panel?1上 p1.add(p2);p1.add(p3);p1.add(p4);p1.add(p5); //可視位置 getLa?yered?Pane().setLa?yout(null);getLa?yered?Pane().add(L,newInteg?er(Integ?er.MIN_V?ALUE));setSi?ze(500,400);setLo?catio?n(450,200);setDe?fault?Close?Opera?tion(JFram?e.EXIT_?ON_CL?OSE); //設(shè)置監(jiān)聽器?b1.addAc?tionL?isten?er(this);b2.addAc?tionL?isten?er(this); }publi?cvoidactio?nPerf?ormed?(Actio?nEven?te){ if((JButt?on)e.getSo?urce()==b1){if(user1?.getSe?lecte?dItem?().equal?s("管理員")){try{Connc?tsql();stmt=conn.creat?eStat?ement?(Resul?tSet.TYPE_?SCROL?L_SEN?SITIV?E,Resul?tSet.CONCU?R_UPD?ATABL?E); rst=stmt.execu?teQue?ry("SELEC?T*FROMusert?ablewhere?id='"+t1.getTe?xt().trim()+"'");if(rst.next()){if(rst.getSt?ring(1).trim().equal?s(t2.getTe?xt().trim())&&!rst.getSt?ring(1).trim().equal?s("")) {this.dispo?se(); Menum=newMenu();} elseif(!rst.getSt?ring(1).trim().equal?s(t2.getTe?xt().trim())&&!rst.getSt?ring(1).trim().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"密碼異常!","溫馨提示!",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE,null);} }elseif(!rst.next()){ JOpti?onPan?e.showM?essag?eDial?og(null,"不存在此用?戶!","溫馨提示!",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE,null); } if(t1.getTe?xt().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入賬號(hào)?!","溫馨提示!",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE,null); } } catch?(Excep?tionerr) {Syste?m.out.print?ln(err);} } elseif(user1?.getSe?lecte?dItem?().equal?s("學(xué)生")){ try{Connc?tsql();stmt=conn.creat?eStat?ement?(Resul?tSet.TYPE_?SCROL?L_SEN?SITIV?E,Resul?tSet.CONCU?R_UPD?ATABL?E);//結(jié)果集可滾?動(dòng),可更新if(t1.getTe?xt().equal?s("")){JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入您的?學(xué)號(hào)!","溫馨提示!",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE,null); }rst=stmt.execu?teQue?ry("SELEC?T*FROMstuus?erwhere?學(xué)號(hào)='"+t1.getTe?xt().trim()+"'");//將輸入的賬?號(hào)與stu?user表?比對(duì)while?(rst.next()){if(rst.getSt?ring(1).trim().equal?s(t2.getTe?xt().trim())) {newMenu2?();dispo?se();} else{ JOpti?onPan?e.showM?essag?eDial?og(null,"密碼異常!","溫馨提示!",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE,null); t1.setTe?xt(null);//清空賬號(hào) t2.setTe?xt(null);//清空密碼 } } } catch?(Excep?tionerr) {Syste?m.out.print?ln(err);} } } elseif((JButt?on)e.getSo?urce()==b2){ this.dispo?se();//關(guān)閉窗體 } }priva?tevoidConnc?tsql(){//連接數(shù)據(jù)庫(kù)?的函數(shù) try{ Class?.forNa?me("com.micro?soft.sqlse?rver.jdbc.SQLSe?rverD?river?");conn=Drive?rMana?ger.getCo?nnect?ion("jdbc:sqlse?rver://local?host:1433;Datab?aseNa?me=stude?nt","sa","12345?6789");//連接stu?dent數(shù)?據(jù)庫(kù) }catch?(Excep?tione){ Syste?m.out.print?ln(e); }}publi?cstati?cvoidmain(Strin?gargs[]){ Login?l=newLogin?();}}③系統(tǒng)主界面?impor?tjava.awt.*;impor?tjava.sql.*;impor?tjavax?.swing?.*;impor?tjava.awt.event?.*;publi?cclass?Menuexten?dsJFram?e{ priva?teJPane?lp1=(JPane?l)getCo?ntent?Pane();priva?teJMenu?Barjmb=newJMenu?Bar();priva?teJMenu?fileM?enu,Dengl?u,help;priva?teJMenu?Iteml?ogout?,exit,add,revis?e,look,delet?,about?syste?m,about?us;Conne?ction?con;State?mentsql;Resul?tSetrs;publi?cMenu(){setTi?tle("學(xué)生信息管?理系統(tǒng)");//設(shè)置背景圖?案Image?Iconb?ackgr?ound=newImage?Icon("image?s\\xiton?g.jpg"); JLabe?lL=newJLabe?l(backg?round?);L.setBo?unds(0,0,800,600);p1.setOp?aque(false?);p1.setLa?yout(null);p1.add(L);getLa?yered?Pane().setLa?yout(null);getLa?yered?Pane().add(L,newInteg?er(Integ?er.MIN_V?ALUE)); setJM?enuBa?r(jmb);fileM?enu=newJMenu?("菜單");Dengl?u=newJMenu?("登陸管理");help=newJMenu?("幫助");jmb.add(fileM?enu);jmb.add(Dengl?u);jmb.add(help);Dengl?u.add(logou?t=newJMenu?Item("注銷"));Dengl?u.add(exit=newJMenu?Item("退出"));fileM?enu.add(add=newJMenu?Item("添加學(xué)生信?息"));fileM?enu.add(revis?e=newJMenu?Item("修改學(xué)生信?息"));fileM?enu.add(look=newJMenu?Item("查詢學(xué)生信?息"));fileM?enu.add(delet?=newJMenu?Item("刪除學(xué)生信?息"));help.add(about?syste?m=newJMenu?Item("關(guān)于系統(tǒng)"));help.add(about?us=newJMenu?Item("關(guān)于我們"));logou?t.addAc?tionL?isten?er(newML());exit.addAc?tionL?isten?er(newML());add.addAc?tionL?isten?er(newML());revis?e.addAc?tionL?isten?er(newML()); look.addAc?tionL?isten?er(newML()); delet?.addAc?tionL?isten?er(newML()); about?syste?m.addAc?tionL?isten?er(newML()); about?us.addAc?tionL?isten?er(newML());setSi?ze(800,600); setVi?sible?(true);setRe?sizab?le(false?);setLo?catio?n(300,100); setDe?fault?Close?Opera?tion(JFram?e.EXIT_?ON_CL?OSE);}publi?cclass?MLimple?ments?Actio?nList?ener{ publi?cvoidactio?nPerf?ormed?(Actio?nEven?te){ Strin?gm=e.getAc?tionC?omman?d(); if(m.equal?s("退出")){ Syste?m.exit(0);} if(m.equal?s("注銷")){ dispo?se();newLogin?();} if(m.equal?s("添加學(xué)生信?息")){ dispo?se();newaddFo?rm();} if(m.equal?s("修改學(xué)生信?息")){ dispo?se();newmodif?yForm?();} if(m.equal?s("查詢學(xué)生信?息")){ dispo?se();newSerch?();} if(m.equal?s("刪除學(xué)生信?息")){dispo?se();newdelet?eForm?();} if(m.equal?s("關(guān)于系統(tǒng)")){newAbout?Syste?m();} if(m.equal?s("關(guān)于我們")){newAbout?me();}}}}④添加學(xué)生界?面impor?tjava.sql.*;impor?tjava.awt.*;impor?tjavax?.swing?.*;impor?tjava.awt.event?.*;impor?tjavax?.swing?.table?.Defau?ltTab?leMod?el;publi?cclass?addFo?rmexten?dsJFram?eimple?ments?Actio?nList?ener{JLabe?llabel?1=newJLabe?l("添加學(xué)生信?息",JLabe?l.CENTE?R);JLabe?llabxu?ehao=newJLabe?l("學(xué)號(hào):",JLabe?l.CENTE?R);JLabe?llabye?ar=newJLabe?l("年齡:",JLabe?l.CENTE?R);JLabe?llabNa?me=newJLabe?l("姓名:",JLabe?l.CENTE?R);JLabe?llabDa?te=newJLabe?l("出生日期:",JLabe?l.CENTE?R);JLabe?llabcl?ass=newJLabe?l("班級(jí):",JLabe?l.CENTE?R);JLabe?llabzy?=newJLabe?l("專業(yè):",JLabe?l.CENTE?R);JLabe?llabmz?=newJLabe?l("院系:",JLabe?l.CENTE?R);JLabe?llabse?x=newJLabe?l("性別:",JLabe?l.CENTE?R);JText?Field?txtNa?me=newJText?Field?(20);JText?Field?txtDa?te=newJText?Field?(18);JText?Field?txtXu?eHao=newJText?Field?(20);JText?Field?txtYe?ar=newJText?Field?(20);JText?Field?txtCl?ass=newJText?Field?(20);JText?Field?txtZY?=newJText?Field?(20);JText?Field?txtYX?=newJText?Field?(20);Butto?nGrou?pbgp=newButto?nGrou?p();JRadi?oButt?onman=newJRadi?oButt?on("男");JRadi?oButt?onwomen?=newJRadi?oButt?on("女");JButt?onbtnAd?d=newJButt?on("添加");JButt?onbtnCa?ncel=newJButt?on("返回");JButt?onbtnRe?set=newJButt?on("重置");JPane?ljpl=newJPane?l();//創(chuàng)建面板對(duì)?象Conne?ction?conn;State?mentstmt;Resul?tSetrst;addFo?rm(){ super?("添加學(xué)生信?息"); this.setRe?sizab?le(false?); this.setSi?ze(550,450); this.setVi?sible?(true); this.setLo?catio?n(400,200); this.setDe?fault?Close?Opera?tion(JFram?e.EXIT_?ON_CL?OSE); this.add(jpl);jpl.setLa?yout(null); btnAd?d.addAc?tionL?isten?er(this); btnRe?set.addAc?tionL?isten?er(this); btnCa?ncel.addAc?tionL?isten?er(this); jpl.setBa?ckgro?und(Color?.cyan); man.setBa?ckgro?und(Color?.cyan);women?.setBa?ckgro?und(Color?.cyan); label?1.setBo?unds(100,20,300,20);jpl.add(label?1); labxu?ehao.setBo?unds(100,50,70,20);jpl.add(labxu?ehao); txtXu?eHao.setBo?unds(190,50,140,20);jpl.add(txtXu?eHao); labNa?me.setBo?unds(100,90,70,20);jpl.add(labNa?me); txtNa?me.setBo?unds(190,90,140,20);jpl.add(txtNa?me); labse?x.setBo?unds(110,130,60,20);jpl.add(labse?x); man.setBo?unds(190,130,60,20);women?.setBo?unds(270,130,60,20); jpl.add(man);jpl.add(women?);bgp.add(man);bgp.add(women?); labye?ar.setBo?unds(100,180,70,20);jpl.add(labye?ar); txtYe?ar.setBo?unds(190,180,140,20);jpl.add(txtYe?ar); labDa?te.setBo?unds(100,210,70,20);jpl.add(labDa?te); txtDa?te.setBo?unds(190,210,140,20);jpl.add(txtDa?te); labmz?.setBo?unds(100,240,70,20);jpl.add(labmz?); txtYX?.setBo?unds(190,240,140,20);jpl.add(txtYX?); labcl?ass.setBo?unds(100,270,70,20);jpl.add(labcl?ass); txtCl?ass.setBo?unds(190,270,140,20);jpl.add(txtCl?ass); labzy?.setBo?unds(100,300,70,20);jpl.add(labzy?); txtZY?.setBo?unds(190,300,140,20);jpl.add(txtZY?); btnRe?set.setBo?unds(80,350,90,20); btnAd?d.setBo?unds(200,350,90,20); btnCa?ncel.setBo?unds(320,350,90,20); jpl.add(btnRe?set);jpl.add(btnAd?d);jpl.add(btnCa?ncel);}publi?cvoidactio?nPerf?ormed?(Actio?nEven?te) { if(e.getSo?urce()==btnCa?ncel){ dispo?se(); newMenu();} if(e.getSo?urce()==btnAd?d) {if(txtXu?eHao.getTe?xt().toStr?ing().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入學(xué)號(hào)?","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE); }elseif(txtNa?me.getTe?xt().toStr?ing().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入姓名?","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE); }elseif(txtYe?ar.getTe?xt().toStr?ing().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入年齡?","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE); }elseif(txtDa?te.getTe?xt().toStr?ing().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"出生日期","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE); }elseif(txtZY?.getTe?xt().toStr?ing().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入專業(yè)?","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE); }elseif(txtYX?.getTe?xt().toStr?ing().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入院系?","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE); }elseif(txtCl?ass.getTe?xt().toStr?ing().equal?s("")){ JOpti?onPan?e.showM?essag?eDial?og(null,"請(qǐng)輸入班級(jí)?","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE);} else{ Strin?gsex; if(man.isSel?ected?()) {sex="男";} else {sex="女";}Connc?tsql(); try{ State?mentstmt=conn.creat?eStat?ement?(); inta=stmt.execu?teUpd?ate("inser?tinto學(xué)籍信息表?(學(xué)號(hào),姓名,年齡,出生日期,性別,班級(jí),專業(yè),院系)value?s('"+txtXu?eHao.getTe?xt()+"','"+txtNa?me.getTe?xt()+"','"+txtYe?ar.getTe?xt()+"','"+txtDa?te.getTe?xt()+"','"+sex+"','"+txtCl?ass.getTe?xt()+"','"+txtZY?.getTe?xt()+"','"+txtYX?.getTe?xt()+"')"); if(a==1) {JOpti?onPan?e.showM?essag?eDial?og(null,"已成功添加?","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE);} else {JOpti?onPan?e.showM?essag?eDial?og(null,"添加失敗","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE);} stmt.close?();} catch?(SQLEx?cepti?onse) {JOpti?onPan?e.showM?essag?eDial?og(null,se.getMe?ssage?());}}} else{ txtCl?ass.setTe?xt("");txtZY?.setTe?xt(""); txtYX?.setTe?xt("");txtNa?me.setTe?xt(""); txtDa?te.setTe?xt("");txtXu?eHao.setTe?xt(""); txtYe?ar.setTe?xt("");txtXu?eHao.reque?stFoc?us();}} publi?cstati?cvoidmain(Strin?g[]args) {newaddFo?rm();}priva?tevoidConnc?tsql(){//連接sql?serve?r2005?數(shù)據(jù)庫(kù)的函?數(shù) try{ Class?.forNa?me("com.micro?soft.sqlse?rver.jdbc.SQLSe?rverD?river?"); conn=Drive?rMana?ger.getCo?nnect?ion("jdbc:sqlse?rver://local?host:1433;Datab?aseNa?me=stude?nt","sa","12345?6789");//連接stu?dent數(shù)?據(jù)庫(kù)}catch?(Excep?tione){Syste?m.out.print?ln(e);}}}⑤修改學(xué)生界?面 impor?tjava.sql.*;impor?tjava.awt.*;impor?tjavax?.swing?.*;impor?tjava.awt.event?.*;publi?cclass?modif?yForm?exten?dsJFram?eimple?ments?Actio?nList?ener{ JPane?ljpl=newJPane?l(); JLabe?lSCH=newJLabe?l("修改學(xué)生信?息",JLabe?l.CENTE?R); Fontf=newFont("楷體",Font.BOLD+Font.ITALI?C,30); JLabe?llabel?1=newJLabe?l("請(qǐng)輸入學(xué)號(hào)?:",JLabe?l.CENTE?R); JButt?onbtnQu?ery=newJButt?on("查詢"); JLabe?llabel?2=newJLabe?l("姓名:",JLabe?l.CENTE?R); JLabe?llabye?ar=newJLabe?l("年齡:",JLabe?l.CENTE?R); JLabe?llabDa?te=newJLabe?l("出生日期:",JLabe?l.CENTE?R); JLabe?llabel?5=newJLabe?l("性別:",JLabe?l.CENTE?R); JLabe?llabel?3=newJLabe?l("班級(jí):",JLabe?l.CENTE?R); JLabe?llabel?4=newJLabe?l("專業(yè):",JLabe?l.CENTE?R);JLabe?llabmz?=newJLabe?l("院系:",JLabe?l.CENTE?R); Butto?nGrou?pbgp=newButto?nGrou?p(); JRadi?oButt?onman=newJRadi?oButt?on("男"); JRadi?oButt?onwomen?=newJRadi?oButt?on("女"); JText?Field?tyear?=newJText?Field?(); JText?Field?tDate?=newJText?Field?(); JText?Field?tmz=newJText?Field?(); JText?Field?num=newJText?Field?(); JText?Field?nam=newJText?Field?(); JText?Field?clas=newJText?Field?(); JText?Field?scl=newJText?Field?(); JButt?onbtnMo?dify=newJButt?on("修改"); JButt?onbtnCa?ncel=newJButt?on("取消"); Conne?ction?con;State?mentsql;Resul?tSetrs; intre; publi?cmodif?yForm?() {this.setSi?ze(560,460);this.setLo?catio?n(400,200); this.setVi?sible?(true);this.setRe?sizab?le(false?); SCH.setFo?regro?und(Color?.red); this.setDe?fault?Close?Opera?tion(JFram?e.EXIT_?ON_CL?OSE); this.add(jpl);jpl.setBa?ckgro?und(Color?.cyan); man.setBa?ckgro?und(Color?.cyan); women?.setBa?ckgro?und(Color?.cyan); jpl.setLa?yout(null); btnQu?ery.addAc?tionL?isten?er(this); btnMo?dify.addAc?tionL?isten?er(this); btnCa?ncel.addAc?tionL?isten?er(this); SCH.setBo?unds(100,20,300,20);jpl.add(SCH); label?1.setBo?unds(100,60,100,20);jpl.add(label?1); num.setBo?unds(220,60,140,20);jpl.add(num); btnQu?ery.setBo?unds(120,100,90,20); btnMo?dify.setBo?unds(230,100,90,20); btnCa?ncel.setBo?unds(340,100,90,20); jpl.add(btnQu?ery);jpl.add(btnMo?dify);jpl.add(btnCa?ncel); label?2.setBo?unds(100,150,70,20);jpl.add(label?2); nam.setBo?unds(190,150,140,20);jpl.add(nam); labye?ar.setBo?unds(100,180,70,20);jpl.add(labye?ar); tyear?.setBo?unds(190,180,140,20);jpl.add(tyear?); labDa?te.setBo?unds(100,210,70,20);jpl.add(labDa?te); tDate?.setBo?unds(190,210,140,20);jpl.add(tDate?); label?5.setBo?unds(100,250,70,20);jpl.add(label?5); man.setBo?unds(205,250,60,20);women?.setBo?unds(285,250,60,20); bgp.add(man);bgp.add(women?);jpl.add(man);jpl.add(women?); label?3.setBo?unds(100,290,70,20);jpl.add(label?3); clas.setBo?unds(190,290,140,20);jpl.add(clas); label?4.setBo?unds(100,320,70,20);jpl.add(label?4); scl.setBo?unds(190,320,140,20);jpl.add(scl); labmz?.setBo?unds(100,350,70,20);jpl.add(labmz?); tmz.setBo?unds(190,350,140,20);jpl.add(tmz);}publi?cvoidactio?nPerf?ormed?(Actio?nEven?tae){if(ae.getSo?urce()==btnCa?ncel){Menum=newMenu();}elseif(ae.getSo?urce()==btnQu?ery){try{ Connc?tsql(); sql=con.creat?eStat?ement?(); rs=sql.execu?teQue?ry("selec?t*from學(xué)籍信息表?where?學(xué)號(hào)='"+num.getTe?xt()+"'");if(rs.next()){ num.setTe?xt(rs.getSt?ring("學(xué)號(hào)")); nam.setTe?xt(rs.getSt?ring("姓名")); tyear?.setTe?xt(rs.getSt?ring("年齡").toStr?ing()); tDate?.setTe?xt(rs.getSt?ring("出生日期")); if(rs.getSt?ring("性別").equal?s("男")) {man.setSe?lecte?d(true);} else {women?.setSe?lecte?d(true);} clas.setTe?xt(rs.getSt?ring("班級(jí)")); scl.setTe?xt(rs.getSt?ring("專業(yè)")); tmz.setTe?xt(rs.getSt?ring("院系"));btnMo?dify.setEn?abled?(true);nam.setEd?itabl?e(true);tyear?.setEd?itabl?e(true);tDate?.setEd?itabl?e(true);clas.setEd?itabl?e(true);scl.setEd?itabl?e(true);tmz.setEd?itabl?e(true);}else{ JOpti?onPan?e.showM?essag?eDial?og(null,"不存在該記?錄!","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE);btnMo?dify.setEn?abled?(false?);tyear?.setTe?xt("");tDate?.setTe?xt("");tmz.setTe?xt("");num.setTe?xt(""); nam.setTe?xt("");clas.setTe?xt(""); scl.setTe?xt("");num.reque?stFoc?us(); nam.setEd?itabl?e(false?);tyear?.setEd?itabl?e(false?);tDate?.setEd?itabl?e(false?);clas.setEd?itabl?e(false?);scl.setEd?itabl?e(false?);tmz.setEd?itabl?e(false?);}}catch?(SQLEx?cepti?one){}}elseif(ae.getSo?urce()==btnMo?dify){Connc?tsql(); try{sql=con.creat?eStat?ement?(); re=sql.execu?teUpd?ate("Updat?e學(xué)籍信息表?set姓名='"+nam.getTe?xt()+"',年齡='"+tyear?.getTe?xt()+"',出生日期='"+tDate?.getTe?xt()+"',班級(jí)='"+clas.getTe?xt()+"',專業(yè)='"+scl.getTe?xt()+"',院系='"+tmz.getTe?xt()+"'where?學(xué)號(hào)='"+num.getTe?xt()+"'"); if(re==1) {JOpti?onPan?e.showM?essag?eDial?og(null,"記錄修改完?畢!","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE);} else {JOpti?onPan?e.showM?essag?eDial?og(null,"記錄修改失?敗!","溫馨提示",JOpti?onPan?e.INFOR?MATIO?N_MES?SAGE);}sql.close?();} catch?(SQLEx?cepti?onse) {JOpti?onPan?e.showM?essag?eDial?og(null,se.getMe?ssage?());}}else{btnMo?dify.setEn?abled?(false?);tyear?.setTe?xt("");tDate?.setTe?xt("");tmz.setTe?xt(""); num.setTe?xt("");nam.setTe?xt("");clas.setTe?xt(""); scl.setTe?xt("");num.reque?stFoc?us(); nam.setEd?itabl?e(false?);tyear?.setEd?itabl?e(false?);tDate?.setEd?itabl?e(false?);clas.setEd?itabl?e(false?);scl.setEd?itabl?e(false?);tmz.setEd?itabl?e(false?);}}priva?tevoidConnc?tsql(){//連接sql?serve?r2005?數(shù)據(jù)庫(kù)的函?數(shù) try{ Class?.forNa?me("com.micro?soft.sqlse?rver.jdbc.SQLSe?rverD?river?"); con=Drive?rMana?ger.getCo?nnect?ion("jdbc:sqlse?rver://local?host:1433;Datab?aseNa?me=stude?nt","sa","12345?6789");//連接stu?dent數(shù)?據(jù)庫(kù) }catch?(Excep?tione){ Syste?m.out.print?ln(e);}}}⑥查詢學(xué)生界?面impor?tjava.awt.*;impor?tjava.sql.*;impor?tjavax?.swing?.*;impor?tjava.awt.event?.*;impor?tjavax?.swing?.table?.Defau?ltTab?leMod?el;publi?cclass?Serch?exten?dsJFram?eimple?ments?Actio?nList?ener{ stati?cSerch?s; JPane?ljpl=newJPane?l(); JLabe?lSCH=newJLabe?l("查詢學(xué)生信?息",JLabe?l.CENTE?R); JLabe?llabel?1=newJLabe?l("請(qǐng)輸入學(xué)號(hào)?:",JLabe?l.CENTE?R); JButt?onserch?=newJButt?on("查詢"); JLabe?llabel?2=newJLabe?l("姓名:",JLabe?l.CENTE?R); JLabe?llabye?ar=newJLabe?l("年齡:",JLabe?l.CENTE?R); JLabe?llabDa?te=newJLabe?l("出生日期:",JLabe?l.CENTE?R); JLabe?llabel?5=newJLabe?l("性別:",JLabe?l.CENTE?R); JLabe?llabel?3=newJLabe?l("班級(jí):",JLabe?l.CENTE?R); JLabe?llabel?4=newJLabe?l("專業(yè):",JLabe?l.CENTE?R);JLabe?llabmz?=newJLabe?l("院系:",JLabe?l.CENTE?R); Butto?nGrou?pbgp=newButto?nGrou?p(); JRadi?oButt?onman=newJRadi?oButt?on("男"); JRadi?oButt?onwomen?=newJRadi?oButt?on("女"); JText?Field?tyear?=newJText?Field?(); JText?Field?tDate?=newJText?Field?(); JText?Field?tmz=newJText?Field?(); JText?Field?num=newJText?Field?(); JText?Field?nam=newJText?Field?(); JText?Field?clas=newJText?Field?(); JText?Field?scl=newJText?Field?(); JButt?onreset?=newJButt?on("重置"); JButt?oncaln=newJButt?on("取消");Conne?ction?conn;State?mentstmt;Resul?tSetrs; publi?cSerch?(){ this.add(jpl); jpl.setBa?ckgro?und(Color?.cyan); man.setBa?ckgro?und(Color?.cyan); women?.setBa?ckgro?und(Color?.cyan); jpl.setLa?yout(null); serch?.addAc?tionL?isten?er(this); reset?.addAc?tionL?isten?er(this); caln.addAc?tionL?isten?er(this); SCH.setBo?unds(100,20,300,20);jpl.add(SCH); label?1.setBo?unds(100,60,100,20);jpl.add(label?1); num.setBo?unds(220,60,140,20);jpl.add(num); serch?.setBo?unds(120,100,90,20); reset?.setBo?unds(230,100,90,20); caln.setBo?unds(340,100,90,20); jpl.add(serch?);jpl.add(reset?);jpl.add(caln); label?2.setBo?unds(100,150,70,20);jpl.add(label?2); nam.setBo?unds(190,150,140,20);jpl.add(nam); labye?ar.setBo?unds(100,180,70,20);jpl.add(labye?ar); tyear?.setBo?unds(190,180,140,20);jpl.add(tyear?); labDa?te.setBo?unds(100,210,70,20);jpl.add(labDa?te); tDate?.setBo?unds(190,210,140,20);jpl.add(tDate?); label?5.setBo?unds(100,250,70,20);jpl.add(label?5); man.setBo?unds(205,250,60,20);women?.setBo?unds(285,250,60,20); bgp.add(man);bgp.add(women?);jpl.add(man);jpl.add(women?); label?3.setBo?unds(100,290,70,20); jpl.add(label?3);clas.setBo?unds(190,290,140,20); jpl.add(clas);label?4.setBo?unds(100,320,70,20); jpl.add(label?4);scl.setBo?unds(190,320,140,20); jpl.add(scl);labmz?.setBo?unds(100,350,70,20); jpl.add(labmz?);tmz.setBo?unds(190,350,140,20);jpl.add(tmz); this.setSi?ze(560,460);this.setLo?catio?n(400,200); this.setVi?sible?(true);this.setRe?sizab?le(false?); this.setDe?fault?Close?Opera?tion(JFram?e.EXIT_?ON_CL?OSE);} publi?cvoidactio?nPerf?ormed?(Actio?nEven?te){ if(e.getSo?urce()==caln){ dispo?se();newMenu();} elseif(e.getSo?urce()==serch?){ Connc?tsql(); try{ State?mentstmt=conn.creat?eStat?ement?(); Resul?tSetrs=stmt.execu?teQue?ry("selec?t*from學(xué)籍信息表?where?學(xué)號(hào)='"+num.getTe?xt()+"'"); if(rs.next()){num.setTe?xt(rs.getSt?ring("學(xué)號(hào)")); nam.setTe?xt(rs.getSt?ring("姓名")); tyear?.setTe?xt(rs.getSt?ring("年齡").toStr?ing()); tDate?.setTe?xt(rs.getSt?ring("出生日期")); if(rs.getSt?ring("性別").equal?s("男")) man.setSe?lecte?d(true); else women?.setSe?lecte?d(true); clas.setTe?xt(rs.getSt?ring("班級(jí)")); scl.setTe?xt(rs.getSt?ring("專業(yè)"
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年代理商服務(wù)品質(zhì)合同
- 2025年咨詢顧問融資合同
- 2025年個(gè)人意外傷害保險(xiǎn)代繳服務(wù)合同樣本4篇
- 2025年度鋼構(gòu)加工行業(yè)市場(chǎng)調(diào)研與分析合同
- 2025年度個(gè)人教育培訓(xùn)貸款合同規(guī)范范本3篇
- 2025年度個(gè)人貸款擔(dān)保糾紛處理合同標(biāo)準(zhǔn)范本3篇
- 2025版新企業(yè)股東協(xié)議書范本:知識(shí)產(chǎn)權(quán)保護(hù)專案3篇
- 2025版住宅小區(qū)木門供應(yīng)商合作協(xié)議2篇
- 2025年度個(gè)人貸款合同違約責(zé)任條款3篇
- 2025年度個(gè)人借條合同與借款合同(家庭維修資金版)4篇
- 八年級(jí)語(yǔ)文下冊(cè) 成語(yǔ)故事 第十五課 諱疾忌醫(yī) 第六課時(shí) 口語(yǔ)交際教案 新教版(漢語(yǔ))
- 中考語(yǔ)文二輪復(fù)習(xí):記敘文閱讀物象的作用(含練習(xí)題及答案)
- 老年外科患者圍手術(shù)期營(yíng)養(yǎng)支持中國(guó)專家共識(shí)(2024版)
- 子宮畸形的超聲診斷
- 2024年1月高考適應(yīng)性測(cè)試“九省聯(lián)考”數(shù)學(xué) 試題(學(xué)生版+解析版)
- (正式版)JBT 11270-2024 立體倉(cāng)庫(kù)組合式鋼結(jié)構(gòu)貨架技術(shù)規(guī)范
- EPC項(xiàng)目采購(gòu)階段質(zhì)量保證措施
- T-NAHIEM 101-2023 急診科建設(shè)與設(shè)備配置標(biāo)準(zhǔn)
- 《復(fù)旦大學(xué)》課件
- 針灸與按摩綜合療法
- 四川2024年專業(yè)技術(shù)人員公需科目“數(shù)字經(jīng)濟(jì)與驅(qū)動(dòng)發(fā)展”參考答案(通用版)
評(píng)論
0/150
提交評(píng)論