JAVA編寫的學生基本信息系統(tǒng)_第1頁
JAVA編寫的學生基本信息系統(tǒng)_第2頁
JAVA編寫的學生基本信息系統(tǒng)_第3頁
JAVA編寫的學生基本信息系統(tǒng)_第4頁
JAVA編寫的學生基本信息系統(tǒng)_第5頁
免費預覽已結(jié)束,剩余18頁可下載查看

下載本文檔

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

文檔簡介

1、"學生根本信息治理系統(tǒng)"運行說明:1 .運行系統(tǒng)2 .輸入治理員姓名和密碼,點擊"進入"按鈕,進行步驟3.假設輸入的姓名或密碼不正確,那么彈出提示對話框,提示"姓名輸入錯誤或密碼輸入錯誤!"b5E2RGbCAP3 .進入操作界面(1假設選擇了"菜單項選擇項"下的"錄入學生根本信息,那么進入錄入界面:輸入要錄入的學號,姓名,選擇性別、專業(yè)、年級、出生日期.假設學號字段為空,那么彈出提示對話框提示"學號字段不能為空!",假設其它字段為空那么彈出對話框提不'"選項不能為空!

2、".plEanqFDPw在正確的輸入下點擊"錄入"按鈕,彈出提示對話框提示"錄入成功.假設要繼續(xù)錄入點擊"重置按鈕.(2假設選擇了"菜單項選擇項"下的"修改學生根本信息",那么進入修改界面:輸入要修改的學號,點擊"開始修改"按鈕,在下面的選項中會顯示待修改的學生的根本信息,此時依次進行修改,修改完成后,點擊"錄入修改",彈出對話框提示"修改成功!".DXDiTa9E3d假設學號輸入為空,那么彈出對話框提示"學號字段不能為空!"

3、.假設輸入的學號沒有在庫中,那么彈出對話框提示"該學號不存在!請確認后再輸入!.(3假設選擇了"菜單項選擇項"下的"查詢學生根本信息",那么進入查詢界面:輸入要查詢的學號,點擊"查詢"按鈕,該學生的根本信息就會在下面的相應項中顯示出來.假設輸入學號為空那么彈出對話框提示"學號字段不能為空!".假設輸入的學號不存在那么彈出對話框提示"該學號不存在!請確認后再輸入!.(4假設選擇了"菜單項選擇項"下的"刪除學生根本信息,那么進入刪除界面:輸入要刪除的學號,打回車,那么該

4、學生的相關信息就會在下面的相應項中顯示出來,點擊"刪除"按鈕彈出對話框"確定要刪除該學生的根本信息嗎?",點擊"是",那么該生根本信息被刪除,點擊"否,那么取消操作.RTCrpUDGiT(5假設選擇了"設置選項"下的"重新設置"菜單,那么彈出重新設置窗口:輸入新的治理員姓名,密碼及確認密碼,點擊"重新注冊",登陸的姓名和密碼就會改變,點擊"取消,不改變.5PCzVD7HxA(6假設選擇了"設置選項"下的"退出"菜單項

5、,那么退出操作界面,返回登陸界面.注:行動環(huán)境eclipse-SDK-3.4.1-win32JAVA的一種集成開發(fā)平臺).zip總體設計本系統(tǒng)共包括8個java源文件和一個SQLServer數(shù)據(jù)庫.1 .類之間的關系如圖1所示.jLBHrnAlLg2.Java源文件及其功能如表1所示表1源文件功能簡介序號文件名主要功能備注1StudentManagers.java學生信息治理系統(tǒng)的訪問權(quán)限含main方法并且權(quán)限唯一2Landat.java菜單項選擇項3StudentSituation.java錄入學生根本信息4ModifySituation.java修改學生根本信息5Inquest.java查

6、詢學生根本信息6Delete.java刪除學生根本信息7Layoututil.java登陸界囿布局8Jdbcenroll.java負責與數(shù)據(jù)庫進行連接詳細設計2 .主類StudentManagers.java成員變量表2)表2成員變量成員變量描述變量類型名稱Txtname,txtpwdbtninTextFieldJButton治理員姓名,治理員密碼登陸(2)方法俵3>表3方法方法名功能備注main啟動學生信息治理系統(tǒng)主函數(shù)StudentManagers設置登陸訪問權(quán)限構(gòu)造方法actionPerformed處理ActionEvent事件接口方法(3)源代碼StudentManagers.j

7、avaimportjava.awt.BorderLayout.importjava.awt.Component.importjava.awt.Container.importjava.awt.GridBagConstraints.importjava.awt.GridBagLayout.importjava.awt.Insets.importjava.awt.event.ActionEvent.importjava.awt.event.ActionListener.importjava.awt.event.TextEvent.importjava.awt.event.TextListener.

8、importjavax.swing.BorderFactory.importjavax.swing.JButton.importjavax.swing.JFrame.importjavax.swing.JLabel.importjavax.swing.JOptionPane.importjavax.swing.JPanel.importjavax.swing.JPasswordField.importjavax.swing.JTextField.publicclassStudentManagersstaticfinalJFramemainf=newJFrame(.JLabelwelcome=n

9、ewJLabel("歡送訪問學生信息治理系統(tǒng)!".JLabellabname=newJLabel("請輸入治理員姓名:".publicJTextFieldtxtname=newJTextField(.JLabellabpwd=newJLabel("請輸入密碼:".publicJPasswordFieldtxtpwd=newJPasswordField(.xHAQX74J0XJButtonbtnin=newJButton("進入.JPanelp.publicStudentManagers(p=newJPanel(>.p.

10、removeAll(>.p.setSize(400,400>.txtname.requestFocus(>0txtname.setText("">.txtpwd.setText("">.p.setBorder(BorderFactory.createLoweredBevelBorder(>>.LDAYtRyKfEp.setLayout(newGridBagLayout(>>.Layoututil.add(p,GridBagConstraints.NONE,GridBagConstraints.CENT

11、ER,0,0,0,0,1,1,labname>.Zzz6ZB2LtkLayoututil.add(p,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,1,0,1,0,1,1,txtname>.dvzfvkwMI1Layoututil.add(p,GridBagConstraints.NONE,GridBagConstraints.CENTER,0,0,0,1,1,1,labpwd>.rqyn14ZNXILayoututil.add(p,GridBagConstraints.HORIZONTAL,GridBagCo

12、nstraints.CENTER,1,0,1,1,1,1,txtpwd>.Emxvx0toeoLayoututil.add(p,GridBagConstraints.NONE,GridBagConstraints.CENTER,0,3,1,1,1,btnin>.SixE2yXPq5mainf.getContentPane(>.add(p,BorderLayout.CENTER>.txtname.requestFocus(>btnin.addActionListener(newActionListener(>publicvoidactionPerformed(

13、ActionEvente>Stringa1=txtname.getText(>.Stringa2=txtpwd.getText(>.txtname.setText("">.txtpwd.setText("">.booleantof=false.jdbcenrollchecks=newjdbcenroll(>.tof=checks.check(a1,a2>.if(tof=false>JOptionPane.showMessageDialog(null,"姓名輸入錯誤或密碼輸入錯誤!",&q

14、uot;警告",JOptionPane.WARNING_MESSAGE>.6ewMyirQFLelseif(tof=true>newLandat(>mainf.setVisible(false>.>.JPanelap=newJPanel(>.ap.setLayout(newBorderLayout(>>.ap.add(welcome,BorderLayout.CENTER>.mainf.getContentPane(>.add(ap,BorderLayout.NORTH>.mainf.setSize(400,400&g

15、t;.mainf.show(>.mainf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE>.kavU42VRUspublicstaticvoidmain(String口args>JPanelmainp=newJPanel(>.StudentManagersstudent=newStudentManagers(>.3 .類Landat.java(1>.成員變量(表4>表4成員變量成員變量描述變量類型名稱菜單條JMenuBarmainmenubar菜單JMenutitlebar,messagebar菜單項JMe

16、nuIteminputs,modify,inquest,delete,reset,otherset標簽JLabellabel布局治理器Boxbox1,box2,box3,box4,boxH文本框JTextFieldtxtname,txtpwd,txtrepwd按鈕JButtonok,cancel(2>方法俵5>表5方法方法名功能備注LandatactionPerformedreenroll選擇菜單項選擇項并執(zhí)行處理ActionEvent事件重新設置治理員姓名和密碼構(gòu)造方法接口方法自定義方法(4)實現(xiàn)代碼importjava.awt.*.importjava.sql.*.import

17、javax.swing.*.importjava.awt.event.*.importjava.awt.event.TextEvent.publicclassLandatextendsJFrameimplementsActionListenery6V3ALoS89privatestaticfinalintSytle=0.JFramefJPanelp.登陸JPanelp2.錄入JPanelp3.修改JPanelp4.查詢JPanelp5.刪除JPanelnewp./*finalinti=0.限制菜單項的翻開次數(shù)錄入學生根本信息finalinti1=0.限制修改學生根本信息項finalinti2=

18、0.限制查詢學生根本信息項finalinti3=0.限制刪除學生根本信息項*/publicLandatsuper.setVisible(false>f=newJFrame("學生學籍治理系統(tǒng)">.p=newJPanel(>p2=newJPanel(>p3=newJPanel(>p4=newJPanel(>p5=newJPanel(>newp=newJPanel(>Boxbox1=Box.createHorizontalBox(>JLabellabel=newJLabel("歡送進入學生根本信息治理系統(tǒng)"

19、;>.label.setForeground(Color.red>.intstyle=Font.ITALIC.Fontfo=newFont("宋體",style,25>.label.setFont(fo>.box1.add(label,JLabel.CENTER>.p.setLayout(newBorderLayout(>>p.add(box1,BorderLayout.CENTER>.ContainercontentPane=f.getContentPane(>.contentPane.add(p,BorderLayo

20、ut.CENTER>.JMenuBarmainmenubar=newJMenuBar(>JMenutitlebar=newJMenu("菜單項選擇項">.JMenuIteminputs=newJMenuItem("錄入學生根本信息">.inputs.addActionListener(this>.JMenuItemmodify=newJMenuItem("修改學生根本信息">.modify.addActionListener(this>.JMenuIteminquest=newJMenuIte

21、m("查詢學生根本信息">.inquest.addActionListener(this>.JMenuItemdelete=newJMenuItem("刪除學生根本信息">.delete.addActionListener(this>.titlebar.add(inputs>.titlebar.add(modify>.titlebar.add(inquest>.titlebar.add(delete>.JMenumessagebar=newJMenu("設置選項">.JMenuIt

22、emreset=newJMenuItem("重新設置>.reset.addActionListener(newActionListener(>publicvoidactionPerformed(ActionEvente>reenrollreenrolls=newreenroll(>.>.JMenuItemotherset=newJMenuItem("退出>.otherset.addActionListener(this>messagebar.add(reset>messagebar.add(otherset>mainme

23、nubar.add(titlebar>mainmenubar.add(messagebar>f.pack(>f.setJMenuBar(mainmenubar>f.setSize(400,400>.f.show(>.publicvoidactionPerformed(ActionEvente>if(e.getActionCommand(>="錄入學生根本信息">p.setVisible(false>p2.setVisible(false>.p3.setVisible(false>.p4.setVisib

24、le(false>.p5.setVisible(false>.StudentSituationstusituation=newStudentSituation(p2>.M2ub6vSTnPf.getContentPane(>.add(p2>.p2.setVisible(true>.elseif(e.getActionCommand(>="修改學生根本信息>(p.setVisible(false>.p2.setVisible(false>.p3.setVisible(false>.p4.setVisible(false&

25、gt;.p5.setVisible(false>.ModifySituationmodsituation=newModifySituation(p3>.0YujCfmUCwf.getContentPane(>.add(p3>.p3.setVisible(true>.elseif(e.getActionCommand(>="查詢學生根本信息>(p.setVisible(false>p2.setVisible(false>p3.setVisible(false>p4.setVisible(false>p5.setVisib

26、le(false>Inquestquest=newInquest(p4>.f.getContentPane(>.add(p4>.p4.setVisible(true>.elseif(e.getActionCommand(>="刪除學生根本信息>(p.setVisible(false>p2.setVisible(false>p3.setVisible(false>p4.setVisible(false>p5.setVisible(false>Deletedeletes=newDelete(p5>.f.getC

27、ontentPane(>.add(p5>.p5.setVisible(true>.elseif(e.getActionCommand(>="退出">(StudentManagersme=newStudentManagers(>.f.setVisible(false>classreenrollextendsJFrameJTextFieldtxtname,txtpwd,txtrepwdJFrameffJPanelpp.publicreenroll(>ff=newJFrame(>pp=newJPanel(>txtname

28、=newJTextField(10>.txtpwd=newJTextField(10>txtrepwd=newJTextField(10>txtrepwd.addActionListener(newActionListener(>publicvoidactionPerformed(ActionEvente>if(!txtrepwd.getText(>.equals(txtpwd.getText(>>>JOptionPane.showMessageDialog(null,"密碼輸入錯誤!","型上,JOption

29、Pane.WARNING_MESSAGE>.eUts8ZQVRdpublicvoidvalueChanged(TextEvente>>JButtonok=newJButton("重新注冊">.ok.addActionListener(newActionListener(>publicvoidactionPerformed(ActionEvente>jdbcenrollreset=newjdbcenroll(>.reset.setloads(txtname.getText(>,txtpwd.getText(>>.sQ

30、sAEJkW5T>JButtoncancel=newJButton("取¥肖>.cancel.addActionListener(newActionListener(>publicvoidactionPerformed(ActionEvente>ff.setVisible(false>.>Boxbox1=Box.createHorizontalBox(>box1.add(newJLabel(請輸入新的治理員姓名:,JLabel.CENTER>>.box1.add(txtname>.Boxbox2=Box.creat

31、eHorizontalBox(>.box2.add(newJLabel("請輸入新的治理員密碼:,JLabel.CENTER>>.box2.add(txtpwd>.Boxbox3=Box.createHorizontalBox(>.box3.add(newJLabel("請確認密碼:",JLabel.CENTER>>.box3.add(txtrepwd>.Boxbox4=Box.createHorizontalBox(>.box4.add(ok>.box4.add(cancel>.BoxboxH=B

32、ox.createVerticalBox(>.boxH.add(box1>.boxH.add(box2>.boxH.add(box3>.boxH.add(box4>.boxH.setSize(300,200>.ff.setSize(300,200>.pp.add(boxH,BorderLayout.CENTER>.ff.add(pp>.ff.setVisible(true>.4 .類StudentSituation(1)成員變量(表6>表6成員變量成員變量描述變量類型名稱文本框JTextFieldTxtnumber,txtnam

33、e組合框JComboBoxTxtspecial,txtgrade,txtborn單項選擇按鈕JRadioButtonradioboy單項選擇按鈕JRadioButtonradiogirl按鈕JButtontruein,resetin(2)方法俵7>表7方法方法名功能備注StudentSituationactionPerformed錄入學生根本信息處理ActionEvent事件構(gòu)造方法接口方法(3)代碼實現(xiàn)importjava.awt.*.importjavax.swing.*.importjava.awt.event.*.publicclassStudentSituationJTextF

34、ieldtxtnumber,txtname.JComboBoxtxtspecial,txtgrade,txtborn.JRadioButtonradioboy,radiogirl.ButtonGroupgroup=null.JButtontruein,resetin.publicStudentSituation(JPanelpsituation>psituation.removeAll(>.psituation.setSize(300,300>.txtnumber=newJTextField(10>.txtname=newJTextField(10>.radiob

35、oy=newJRadioButton("男">.radiogirl=newJRadioButton("女">.group=newButtonGroup(>.txtspecial=newJComboBox(>.txtspecial.addItem("計算機">.txtspecial.addItem("英語">.txtspecial.addItem("機械">.txtspecial.addItem("汽服">.txtspecial.

36、addItem("音樂>.txtspecial.addItem("漢語學">.txtgrade=newJComboBox(>.txtgrade.addItem("2004級>.txtgrade.addItem("2005級>.txtgrade.addItem("2006級>.txtgrade.addItem("2007級>.txtgrade.addItem("2021級>.txtgrade.addItem("2021級>.txtgrade.addIte

37、m("2021級>.txtborn=newJComboBox(>.txtborn.addItem("1985">.txtborn.addItem("1986">.txtborn.addItem("1987">txtborn.addItem("1988">txtborn.addItem("1989">txtborn.addItem("1990">txtborn.addItem("1991">tr

38、uein=newJButton("錄入">.truein.addActionListener(newActionListener(>publicvoidactionPerformed(ActionEvente>Stringnumber=txtnumber.getText(>.Stringname=txtname.getText(>.Stringsex=null.if(radioboy.isSelected(>>sex=radioboy.getText(>.elseif(radiogirl.isSelected(>>

39、sex=radiogirl.getText(>.Stringspecial=null.Objectsp=null.Stringgrade=null.Objectgr=null.Stringborn=null.Objectbo=index1=txtspecial.getSelectedIndex(>.switch(index1>case0:sp=txtspecial.getItemAt(0>.break.case1:sp=txtspecial.getItemAt(1>.break.case2:sp=txtspecial.getItemAt(2>

40、.break.case3:sp=txtspecial.getItemAt(3>.break.case4:sp=txtspecial.getItemAt(4>.break.case5:sp=txtspecial.getItemAt(5>.break.special=(String>index2=txtgrade.getSelectedIndex(>.switch(index2>case0:gr=txtgrade.getItemAt(0>.break.case1:gr=txtgrade.getItemAt(1>.break.case2:g

41、r=txtgrade.getItemAt(2>.break.case3:gr=txtgrade.getItemAt(3>.break.case4:gr=txtgrade.getItemAt(4>.break.case5:gr=txtgrade.getItemAt(5>.break.case6:gr=txtgrade.getItemAt(6>.break.grade=(String>index3=txtborn.getSelectedIndex(>.switch(index3>case0:bo=txtborn.getItemAt(0&g

42、t;.break.case1:bo=txtborn.getItemAt(1>.break.case2:bo=txtborn.getItemAt(2>.break.case3:bo=txtborn.getItemAt(3>.break.case4:bo=txtborn.getItemAt(4>.break.case5:bo=txtborn.getItemAt(5>.break.case6:bo=txtborn.getItemAt(6>.break.born=(String>bo.jdbcenrollinputs=newjdbcenroll(>.in

43、puts.input(number,name,sex,special,grade,born>.>.resetin=newJButton("重置">.resetin.addActionListener(newActionListener(>publicvoidactionPerformed(ActionEvente>txtnumber.setText("">.txtname.setText("">.radioboy.setSelected(false>radiogirl.setSelect

44、ed(false>>group.add(radioboy>.group.add(radiogirl>.Boxbox1=Box.createHorizontalBox(>.box1.add(newJLabel("學號:",JLabel.CENTER>>.box1.add(txtnumber>.Boxbox2=Box.createHorizontalBox(>.box2.add(newJLabel("姓名:",JLabel.CENTER>>.box2.add(txtname>.Boxbo

45、x3=Box.createHorizontalBox(>.box3.add(newJLabel("性另k",JLabel.CENTER>>.box3.add(radioboy>.box3.add(radiogirl>.Boxbox4=Box.createHorizontalBox(>.box4.add(newJLabel("專業(yè):",JLabel.CENTER>>.box4.add(txtspecial>.Boxbox5=Box.createHorizontalBox(>.box5.add(ne

46、wJLabel("年級:",JLabel.CENTER>>.box5.add(txtgrade>.Boxbox6=Box.createHorizontalBox(>.box6.add(newJLabel("出生:">>.box6.add(txtborn>.Boxbox7=Box.createHorizontalBox(>.box7.add(truein>.box7.add(resetin>.BoxboxH=Box.createVerticalBox(>.boxH.add(box1>.

47、boxH.add(box2>.boxH.add(box3>.boxH.add(box4.boxH.add(box5.boxH.add(box6.boxH.add(box7.boxH.setSize(300,300.psituation.add(boxH.4 .類Inquest(1.成員變量(表8表8成員變量成員變量描述變量類型名稱文本框JTextFieldnumber,name,special,grade,born單項選擇按鈕JRadioButtonboy,girl按鈕JButtonsearch(2>方法俵9>表9方法方法名功能備注InquestactionPerformed查詢已錄入學生信息處理ActionEvent事件按學號進行查詢接口方法(4)代碼實現(xiàn)importjava.awt.*.importjavax.swing.*.importjava.awt.event.*.publicclassInquest

溫馨提示

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

評論

0/150

提交評論