版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、java版學(xué)籍管理系統(tǒng)源代碼 package 學(xué)籍管理系統(tǒng);/* * to change this template, choose tools | templates * and open the template in the editor. */* * * author administrator */import java.awt.*;import t.*;import javax.swing.*;import java.io.*;import java.util.*;public class delete extends jpanel implements actionlistene
2、r /* * */private static final long serialversionuid 1l;hashtable 基本信息表 null; jtextfield 學(xué)號,姓名,專業(yè),年級,出生; jradiobutton 男,女; jbutton 刪除; buttongroup group null; fileinputstream inone null; objectinputstream intwo null; fileoutputstream outone null; objectoutputstream outtwo null; file file null; public
3、 delete file file this.file file; 學(xué)號 new jtextfield 10 ; 刪除 new jbutton 刪除 ; 學(xué)號.addactionlistener this ; 刪除.addactionlistener this ; 姓名 new jtextfield 10 ; 姓名.seteditable false ; 專業(yè) new jtextfield 10 ; 專業(yè).seteditable false ; 年級 new jtextfield 10 ; 年級.seteditable false ; 出生 new jtextfield 10 ; 出生.set
4、editable false ; 男 new jradiobutton 男,false ; 女 new jradiobutton 女,false ; group new buttongroup ; group.add 男 ; group.add 女 ; box box1 box.createhorizontalbox ; box1.add new jlabel 輸入要刪除的學(xué)號:,jlabel.center ; box1.add 學(xué)號 ; box1.add 刪除 ; box box2 box.createhorizontalbox ; box2.add new jlabel 姓名:,jlabe
5、l.center ; box2.add 姓名 ; box box3 box.createhorizontalbox ; box3.add new jlabel 性別:,jlabel.center ; box3.add 男 ; box3.add 女 ; box box4 box.createhorizontalbox ; box4.add new jlabel 專業(yè):,jlabel.center ; box4.add 專業(yè) ; box box5 box.createhorizontalbox ; box5.add new jlabel 年級:,jlabel.center ; box5.add 年
6、級 ; box box6 box.createhorizontalbox ; box6.add new jlabel 出生:,jlabel.center ; box6.add 出生 ; box boxh box.createverticalbox ; boxh.add box1 ; boxh.add box2 ; boxh.add box3 ; boxh.add box4 ; boxh.add box5 ; boxh.add box6 ; boxh.add box.createverticalglue ; jpanel pcenter new jpanel ; pcenter.add boxh
7、 ; setlayout new borderlayout ; add pcenter,borderlayout.center ; validate ; public void actionperformed actionevent e if e.getsource 刪除|e.getsource 學(xué)號 string number ; number 學(xué)號.gettext ; if number.length 0 try inone new fileinputstream file ; intwo new objectinputstream inone ; 基本信息表 hashtable intw
8、o.readobject ; inone.close ; intwo.close ; catch exception ee if 基本信息表.containskey number student stu student 基本信息表.get number ; 姓名.settext stu.getname ; 專業(yè).settext stu.getdisciping ; 年級.settext stu.getgrade ; 出生.settext stu.getborth ; if stu.getsex .equals 男 男.setselected true ; else 女.setselected
9、true ; string m 確定要刪除該學(xué)號及全部信息嗎?; int ok joptionpane.showconfirmdialog this,m,確認(rèn),joptionpane.yes_no_option, joptionpane.question_message ; if ok joptionpane.yes_option 基本信息表.remove number ; try outone new fileoutputstream file ; outtwo new objectoutputstream outone ; outtwo.writeobject 基本信息表 ; outtwo
10、.close ; outone.close ; 學(xué)號.settext null ; 姓名.settext null ; 專業(yè).settext null ; 年級.settext null ; 出生.settext null ; catch exception ee sytln ee ; else if ok joptionpane.no_option 學(xué)號.settext null ; 姓名.settext null ; 專業(yè).settext null ; 年級.settext null ; 出生.settext null ; else string warning 該學(xué)號不存在!; jopt
11、ionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; else string warning 必須要輸入學(xué)號!; joptionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; package 學(xué)籍管理系統(tǒng);/* * to change this template, choose tools | templates * and open the template in the editor. */* * * autho
12、r administrator */import java.awt.*;import t.*;import javax.swing.*;import java.io.*;import java.util.*;public class inquest extends jdialog implements actionlistener /* * */private static final long serialversionuid 1l;hashtable 基本信息表 null; jtextfield 學(xué)號,姓名,專業(yè),年級,出生; jradiobutton 男,女; jbutton 查詢; b
13、uttongroup group null; fileinputstream inone null; objectinputstream intwo null; file file null; public inquest jframe f,file file super f,查詢對話框,false ; this.file file; 學(xué)號 new jtextfield 10 ; 查詢 new jbutton 查詢 ; 學(xué)號.addactionlistener this ; 查詢.addactionlistener this ; 姓名 new jtextfield 10 ; 姓名.setedi
14、table false ; 專業(yè) new jtextfield 10 ; 專業(yè).seteditable false ; 年級 new jtextfield 10 ; 年級.seteditable false ; 出生 new jtextfield 10 ; 出生.seteditable false ; 男 new jradiobutton 男,false ; 女 new jradiobutton 女,false ; group new buttongroup ; group.add 男 ; group.add 女 ; box box1 box.createhorizontalbox ; box
15、1.add new jlabel 輸入要查詢的學(xué)號:,jlabel.center ; box1.add 學(xué)號 ; box1.add 查詢 ; box box2 box.createhorizontalbox ; box2.add new jlabel 姓名:,jlabel.center ; box2.add 姓名 ; box box3 box.createhorizontalbox ; box3.add new jlabel 性別:,jlabel.center ; box3.add 男 ; box3.add 女 ; box box4 box.createhorizontalbox ; box4
16、.add new jlabel 專業(yè):,jlabel.center ; box4.add 專業(yè) ; box box5 box.createhorizontalbox ; box5.add new jlabel 年級:,jlabel.center ; box5.add 年級 ; box box6 box.createhorizontalbox ; box6.add new jlabel 出生:,jlabel.center ; box6.add 出生 ; box boxh box.createverticalbox ; boxh.add box1 ; boxh.add box2 ; boxh.ad
17、d box3 ; boxh.add box4 ; boxh.add box5 ; boxh.add box6 ; boxh.add box.createverticalglue ; jpanel pcenter new jpanel ; pcenter.add boxh ; container con getcontentpane ; con.add pcenter,borderlayout.center ; con.validate ; setvisible false ; setbounds 100,200,360,270 ; addwindowlistener new windowada
18、pter public void windowclosing windowevent e setvisible false ; ; public void actionperformed actionevent e 姓名.settext null ; 專業(yè).settext null ; 年級.settext null ; 出生.settext null ; if e.getsource 查詢|e.getsource 學(xué)號 string number ; number 學(xué)號.gettext ; if number.length 0 try inone new fileinputstream fi
19、le ; intwo new objectinputstream inone ; 基本信息表 hashtable intwo.readobject ; inone.close ; intwo.close ; catch exception ee if 基本信息表.containskey number student stu student 基本信息表.get number ; 姓名.settext stu.getname ; 專業(yè).settext stu.getdisciping ; 年級.settext stu.getgrade ; 出生.settext stu.getborth ; if
20、stu.getsex .equals 男 男.setselected true ; else 女.setselected true ; else string warning 該學(xué)號不存在!; joptionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; else string warning 必須要輸入學(xué)號!; joptionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; package 學(xué)籍管理系統(tǒng);/* * t
21、o change this template, choose tools | templates * and open the template in the editor. */* * * author administrator */import java.awt.*;import t.*;import javax.swing.*;import java.io.*;import java.util.*;public class modifysituation extends jpanel implements actionlistener /* * */private static fin
22、al long serialversionuid 1l;hashtable 基本信息表 null; jtextfield 學(xué)號,姓名,專業(yè),年級,出生; jradiobutton 男,女; buttongroup group null; jbutton 開始修改,錄入修改,重置; fileinputstream inone null; objectinputstream intwo null; fileoutputstream outone null; objectoutputstream outtwo null; file file null; public modifysituation
23、file file this.file file; 學(xué)號 new jtextfield 10 ; 姓名 new jtextfield 10 ; 專業(yè) new jtextfield 10 ; 年級 new jtextfield 10 ; 出生 new jtextfield 10 ; group new buttongroup ; 男 new jradiobutton 男,true ; 女 new jradiobutton 女,false ; group.add 男 ; group.add 女 ; 開始修改 new jbutton 開始修改 ; 錄入修改 new jbutton 錄入修改 ; 錄入
24、修改.setenabled false ; 重置 new jbutton 重置 ; 學(xué)號.addactionlistener this ; 開始修改.addactionlistener this ; 錄入修改.addactionlistener this ; 重置.addactionlistener this ; box box1 box.createhorizontalbox ; box1.add new jlabel 輸入要修改信息的學(xué)號:,jlabel.center ; box1.add 學(xué)號 ; box1.add 開始修改 ; box box2 box.createhorizontal
25、box ; box2.add new jlabel 新 姓名:,jlabel.center ; box2.add 姓名 ; box box3 box.createhorizontalbox ; box3.add new jlabel 新 性別:,jlabel.center ; box3.add 男 ; box3.add 女 ; box box4 box.createhorizontalbox ; box4.add new jlabel 新 專業(yè):,jlabel.center ; box4.add 專業(yè) ; box box5 box.createhorizontalbox ; box5.add
26、new jlabel 新 年級:,jlabel.center ; box5.add 年級 ; box box6 box.createhorizontalbox ; box6.add new jlabel 新 出生:,jlabel.center ; box6.add 出生 ; box boxh box.createverticalbox ; boxh.add box1 ; boxh.add box2 ; boxh.add box3 ; boxh.add box4 ; boxh.add box5 ; boxh.add box6 ; boxh.add box.createverticalglue ;
27、 jpanel pcenter new jpanel ; pcenter.add boxh ; setlayout new borderlayout ; add pcenter,borderlayout.center ; jpanel psouth new jpanel ; psouth.add 錄入修改 ; psouth.add 重置 ; add psouth,borderlayout.south ; validate ; public void actionperformed actionevent e if e.getsource 開始修改|e.getsource 學(xué)號 string n
28、umber ; number 學(xué)號.gettext ; if number.length 0 try inone new fileinputstream file ; intwo new objectinputstream inone ; 基本信息表 hashtable intwo.readobject ; inone.close ; intwo.close ; catch exception ee if 基本信息表.containskey number 錄入修改.setenabled true ; student stu student 基本信息表.get number ; 姓名.sette
29、xt stu.getname ; 專業(yè).settext stu.getdisciping ; 年級.settext stu.getgrade ; 出生.settext stu.getborth ; if stu.getsex .equals 男 男.setselected true ; else 女.setselected true ; else 錄入修改.setenabled false ; string warning 該學(xué)號不存在!; joptionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; 學(xué)
30、號.settext null ; 姓名.settext null ; 專業(yè).settext null ; 年級.settext null ; 出生.settext null ; else 錄入修改.setenabled false ; string warning 必須要輸入學(xué)號!; joptionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; 學(xué)號.settext null ; 姓名.settext null ; 專業(yè).settext null ; 年級.settext null ; 出生.settex
31、t null ; else if e.getsource 錄入修改 string number ; number 學(xué)號.gettext ; if number.length 0 try inone new fileinputstream file ; intwo new objectinputstream inone ; 基本信息表 hashtable intwo.readobject ; inone.close ; intwo.close ; catch exception ee if 基本信息表.containskey number string question 該生基本信息已存在,您想
32、修改他 她 的基本信息嗎?; joptionpane.showmessagedialog this,question,警告,joptionpane.question_message ; string m 基本信息將被修改!; int ok joptionpane.showconfirmdialog this,m,確認(rèn),joptionpane.yes_no_option, joptionpane.information_message ; if ok joptionpane.yes_option string name 姓名.gettext ; string discipling 專業(yè).gett
33、ext ; string grade 年級.gettext ; string borth 出生.gettext ; string sex null; if 男.isselected sex 男.gettext ; else sex 女.gettext ; student 學(xué)生 new student ; 學(xué)生.setnumber number ; 學(xué)生.setname name ; 學(xué)生.setdiscipling discipling ; 學(xué)生.setgrade grade ; 學(xué)生.setborth borth ; 學(xué)生.setsex sex ; try outone new fileou
34、tputstream file ; outtwo new objectoutputstream outone ; 基本信息表.put number,學(xué)生 ; outtwo.writeobject 基本信息表 ; outtwo.close ; outone.close ; 學(xué)號.settext null ; 姓名.settext null ; 專業(yè).settext null ; 年級.settext null ; 出生.settext null ; catch exception ee sytln ee ; 錄入修改.setenabled false ; else if ok joptionpa
35、ne.no_option 錄入修改.setenabled true ; else string warning 該學(xué)號沒有基本信息,不能修改!; joptionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; 錄入修改.setenabled false ; else string warning 必須要輸入學(xué)號!; joptionpane.showmessagedialog this,warning,警告,joptionpane.warning_message ; 錄入修改.setenabled false ; if e.getsource 重置 學(xué)號.settext null ; 姓名.settext null ; 專業(yè).settext null ; 年級.settext null ; 出生.settext null ; package 學(xué)籍管理系統(tǒng);/* * to change this template, choose tools | templates * and open the template in the editor. */* * * author adm
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年合伙市場拓展協(xié)議
- 2025年仲裁裁決合同范本
- 2025年劍術(shù)表演協(xié)議
- 2025年度高端商業(yè)街區(qū)門面店鋪轉(zhuǎn)讓及租賃合作協(xié)議書3篇
- 二零二五版首付款分期購房借款合同樣本3篇
- 2025年度木地板翻新與保養(yǎng)服務(wù)合同4篇
- 2025年新型節(jié)能廚房電器研發(fā)與銷售合作協(xié)議4篇
- 2025年度個人分紅協(xié)議書包含金融科技分紅條款4篇
- 二零二五年度新型木托盤租賃及信息化管理服務(wù)合同4篇
- 2025年度上市公司合規(guī)管理法律顧問合同
- 湖北省石首楚源“源網(wǎng)荷儲”一體化項(xiàng)目可研報告
- 醫(yī)療健康大數(shù)據(jù)平臺使用手冊
- 碳排放管理員 (碳排放核查員) 理論知識考核要素細(xì)目表四級
- 撂荒地整改協(xié)議書范本
- 診所負(fù)責(zé)人免責(zé)合同范本
- 2024患者十大安全目標(biāo)
- 會陰切開傷口裂開的護(hù)理查房
- 實(shí)驗(yàn)報告·測定雞蛋殼中碳酸鈣的質(zhì)量分?jǐn)?shù)
- 部編版小學(xué)語文五年級下冊集體備課教材分析主講
- 電氣設(shè)備建筑安裝施工圖集
- 《工程結(jié)構(gòu)抗震設(shè)計(jì)》課件 第10章-地下建筑抗震設(shè)計(jì)
評論
0/150
提交評論