《JAVA学生管理源代码 .docx》由会员分享,可在线阅读,更多相关《JAVA学生管理源代码 .docx(65页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精品名师归纳总结/Student_Management_System.java/JHelpTextPanel.java import java.awt.*。import java.awt.event.*。import javax.swing.*。 import javax.swing.event.*。import java.io.*。/ 定义帮忙文档类class JHelpTextPanel extends JPanelFont newSmallTitleFont=new Font JTextArea HelpText=new JTextArea楷体,Font.BOLD,12。JHelpTex
2、tPanelsetLayoutnull。setBackgroundColor.orange。HelpText.setBackgroundColor.orange。HelpText.setForegroundColor.red。HelpText.setFontnewSmallTitleFont。HelpText.setBounds0,0,600,600。addHelpText。/Student_InforPanel .javaimport java.awt.*。 import java.awt.event.*。import javax.swing.*。import javax.swing.eve
3、nt.*。import java.io.*。class Student_InforPanel extends JPanel implements ActionListener/ 四种常用字体的定义Font newTitleFont=new Font楷体,Font.BOLD,40。 Font newSmallTitleFont=new Font楷体,Font.BOLD,25 。Font newCommonFont=new Font宋体,Font.BOLD,20。可编辑资料 - - - 欢迎下载精品名师归纳总结Font newSubMenuFont=new Font 宋体,Font.BOLD,15
4、 。Font NewSubMenuFont=new Font 宋体,Font.BOLD,10 。/ 性别数组定义String os=男 ,女 。/定义确认对话框图标ImageIcon thinker=new ImageIconICON/thinker.gif。/定义同学信息治理系统面板菜单控件JLabel StudentSno_Clue=new JLabel学号: 。JLabel StudentName_Clue=new JLabel姓名: 。JLabel StudentSex_Clue=new JLabel性别: 。JLabel StudentAge_Clue=new JLabel年龄: 。
5、JLabel StudentClass_Clue=new JLabel班级: 。JLabel StudentDept_Clue=new JLabel系别: 。JTextField StudentSno_Input=new JTextField。JTextField StudentName_Input=new JTextField。ComboBoxModel Othermode=new OtherAModel。JComboBox StudentSex_Input=new JComboBoxOthermode。JTextField StudentAge_Input=new JTextField。J
6、TextField StudentClass_Input=new JTextField。JTextField StudentDept_Input=new JTextField。JTextArea QueryInforShow=new JTextArea。JLabel QueryClue=new JLabel以下是你要查询的同学信息 : 。JButton Add_StudentInformation=new JButton增加同学信息 。JButton Del_StudentInformation=new JButton删除同学信息 。JButton Query_StudentInformati
7、on=new JButton查询同学信息 。JButton Modify_StudentInformation=new JButton修改同学信息 。/定义变量int ValidAge。String SnoOrigin。Student_InforPanelsetBackgroundColor.orange。QueryInforShow.setBackgroundColor.orange。setLayoutnull。StudentSno_Clue.setBounds270,120,80,30。StudentSno_Clue.setFontnewCommonFont 。StudentSno_Inp
8、ut.setBounds350,120,120,30。StudentName_Clue.setBounds270,170,80,30。StudentName_Clue.setFontnewCommonFont。可编辑资料 - - - 欢迎下载精品名师归纳总结StudentName_Input.setBounds350,170,120,30。StudentSex_Clue.setBounds270,220,80,30。StudentSex_Clue.setFontnewCommonFont 。StudentSex_Input.setBounds350,220,120,30。StudentAge_
9、Clue.setBounds270,270,80,30。StudentAge_Clue.setFontnewCommonFont 。StudentAge_Input.setBounds350,270,120,30。StudentClass_Clue.setBounds270,320,80,30。StudentClass_Clue.setFontnewCommonFont。StudentClass_Input.setBounds350,320,120,30。StudentDept_Clue.setBounds270,370,80,30。StudentDept_Clue.setFontnewCom
10、monFont 。StudentDept_Input.setBounds350,370,120,30。Query_StudentInformation.setBounds80,120,130,30。Query_StudentInformation.setFontnewSubMenuFont。Query_StudentInformation.addActionListenerthis。QueryClue.setBounds80,180,300,50。QueryClue.setFontnewSubMenuFont 。QueryInforShow.setBounds80,220,530,100。Qu
11、eryInforShow.setFontnewSubMenuFont。Del_StudentInformation.setBounds80,120,130,30。Del_StudentInformation.setFontnewSubMenuFont。Del_StudentInformation.addActionListenerthis。Add_StudentInformation.setBounds80,170,130,30。Add_StudentInformation.setFontnewSubMenuFont。Add_StudentInformation.addActionListen
12、erthis。Modify_StudentInformation.setBounds80,220,130,30。Modify_StudentInformation.setBounds80,220,130,30。Modify_StudentInformation.setFontnewSubMenuFont。Modify_StudentInformation.addActionListenerthis。addStudentSno_Clue 。addStudentSno_Input。addStudentName_Clue 。addStudentName_Input 。addStudentSex_Cl
13、ue 。addStudentSex_Input。addStudentAge_Clue 。addStudentAge_Input。addStudentClass_Clue。addStudentClass_Input。addStudentDept_Clue。addStudentDept_Input。可编辑资料 - - - 欢迎下载精品名师归纳总结addQueryClue 。addQueryInforShow 。addAdd_StudentInformation。addDel_StudentInformation。addQuery_StudentInformation。addModify_Stude
14、ntInformation。public void actionPerformedActionEvent eife.getSource=Add_StudentInformationifIsValidAgeStudentAge_Input.getTextString *=StringStudentSex_Input.getSelectedItem。MainMenu.myDatabase.Add_Database_InformationStudentSno_Input.ge tText,StudentName_Input.getText,*,ValidAge,StudentClass_Input.
15、getT ext,StudentDept_Input.getText。emptyInput。ife.getSource=Del_StudentInformationQueryInforShow.setText。ifMainMenu.myDatabase.Query_Database_InformationStuden tSno_Input.getTextQueryInforShow.setTextDataBaseControl.temptInformation。int result=JOptionPane.showConfirmDialognull,你确定要删除该生信息吗? ,ConfirmM
16、essage,JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,think er 。ifresult=JOptionPane.YES_OPTIONifMainMenu.myDatabase.Del_Database_InformationSt udentSno_Input.getTextJOptionPane.showMessageDialognull,删除操作成功!,Happy Message,JOptionPane.PLAIN_MESSAGE。elseJOptionPane.showMessageDialognull,数据库操作显
17、现反常,删除操作失败! ,Error Message,JOptionPane.ERROR_MESSAGE。else可编辑资料 - - - 欢迎下载精品名师归纳总结息. 。QueryInforShow.setText对不起,没有找到你要删除的同学信可编辑资料 - - - 欢迎下载精品名师归纳总结ife.getSource=Query_StudentInformationQueryInforShow.setText。ifMainMenu.myDatabase.Query_Database_InformationStud entSno_Input.getTextQueryInforShow.setT
18、extDataBaseControl.temptInformatio可编辑资料 - - - 欢迎下载精品名师归纳总结n 。信息 。elseQueryInforShow.setText对不起,没有你想要查询的同学可编辑资料 - - - 欢迎下载精品名师归纳总结ife.getSource=Modify_StudentInformationifIsValidAgeStudentAge_Input.getTextMainMenu.myDatabase.Modify_Database_InformationSnoOri gin,StudentSno_Input.getText,StudentName_I
19、nput.getText,ValidAge,StudentClass_Inpu t.getText,StudentDept_Input.getText。可编辑资料 - - - 欢迎下载精品名师归纳总结trypublic boolean IsValidAgeString StringAgeValidAge=Integer.parseIntStringAge。可编辑资料 - - - 欢迎下载精品名师归纳总结catchNumberFormatException ee.printStackTrace。return false。ifValidAge0 return true。elseJOptionPan
20、e.showMessageDialognull,你输入的年龄不合实际情形 n请重新输入 .,WARNING MESSAGE,JOptionPane.WARNING_MESSAG。E return false。可编辑资料 - - - 欢迎下载精品名师归纳总结class OtherAModel extends DefaultComboBoxModelOtherAModelforint i=0。ios.length。i+ addElementosi。public void emptyInputStudentSno_Input.setText。StudentAge_Input.setText。Stud
21、entName_Input.setText。StudentClass_Input.setText。StudentDept_Input.setText。public void OnlyShowSnoStudentSno_Clue.setVisibletrue。StudentSno_Input.setVisibletrue。StudentSno_Input.setText。QueryClue.setVisibletrue。QueryInforShow.setVisibletrue。StudentName_Clue.setVisiblefalse。StudentName_Input.setVisib
22、lefalse。StudentSex_Clue.setVisiblefalse。StudentSex_Input.setVisiblefalse。StudentAge_Clue.setVisiblefalse。StudentAge_Input.setVisiblefalse。StudentClass_Clue.setVisiblefalse。StudentClass_Input.setVisiblefalse。StudentDept_Clue.setVisiblefalse。StudentDept_Input.setVisiblefalse。/显示同学信息的全部面板控件public void
23、ShowWholeStudentSno_Clue.setVisibletrue。StudentSno_Input.setVisibletrue。StudentSno_Input.setText。QueryClue.setVisiblefalse。可编辑资料 - - - 欢迎下载精品名师归纳总结QueryInforShow.setVisiblefalseStudentName_Clue.setVisibletrue。StudentName_Input.setVisibletrue。StudentName_Input.setText。StudentSex_Clue.setVisibletrue。S
24、tudentSex_Input.setVisibletrue。StudentAge_Clue.setVisibletrue。StudentAge_Input.setVisibletrue。StudentAge_Input.setText。StudentClass_Clue.setVisibletrue。StudentClass_Input.setVisibletrueStudentClass_Input.setText。StudentDept_Clue.setVisibletrue。StudentDept_Input.setVisibletrue。StudentDept_Input.setTe
25、xt。/Student_ScorePanel.javaimport java.awt.*。 import java.awt.event.*。import javax.swing.*。import javax.swing.event.*。class Student_ScorePanel extends JPanel implements ActionListener/ 三种常用字体的定义Font newTitleFont=new Font楷体,Font.BOLD,40。 Font newSmallTitleFont=new Font楷体,Font.BOLD,25 。Font newCommonF
26、ont=new Font宋体,Font.BOLD,20。 Font newSubMenuFont=new Font 宋体,Font.BOLD,15 。Font NewSubMenuFont=new Font 宋体,Font.BOLD,10 。/定义确认对话框图标ImageIcon thinker=new ImageIconICON/thinker.gif。JLabel ScoreSno_Clue=new JLabel学号: 。JLabel ScoreEnglish_Clue=new JLabel英语: 。JLabel ScoreSeniorMath_Clue=new JLabel高数: 。JL
27、abel ScoreC_Clue=new JLabelC:。JLabel ScoreVC_Clue=new JLabelVC:。JLabel ScoreJAVA_Clue=new JLabelJAVA:。可编辑资料 - - - 欢迎下载精品名师归纳总结JTextField ScoreSno_Input=new JTextField。JTextField ScoreEnglish_Input=new JTextField。JTextField ScoreSeniorMath_Input=new JTextField。JTextField ScoreC_Input=new JTextField。
28、JTextField ScoreVC_Input=new JTextField。JTextField ScoreJAVA_Input=new JTextField。JTextArea ScoreShow=new JTextArea。JLabel ScoreShowClue=new JLabel你要查询的同学成果信息为 : 。JButton Add_ScoreInformation=new JButton增加同学成果 。JButton Del_ScoreInformation=new JButton删除同学成果 。JButton Query_ScoreInformation=new JButto
29、n查询同学成果 。JButton Modify_ScoreInformation=new JButton修改同学成果 。/定义变量int ValidScore。String ScoreSno。Student_ScorePanel/ 同学成果治理面板设置控件setBackgroundColor.orange。ScoreShow.setBackgroundColor.orange。setLayoutnull。ScoreSno_Clue.setBounds270,120,80,30。ScoreSno_Clue.setFontnewCommonFont 。ScoreSno_Input.setBound
30、s350,120,120,30。ScoreEnglish_Clue.setBounds270,170,80,30。ScoreEnglish_Clue.setFontnewCommonFont。ScoreEnglish_Input.setBounds350,170,120,30。ScoreSeniorMath_Clue.setBounds270,220,80,30。ScoreSeniorMath_Clue.setFontnewCommonFont 。ScoreSeniorMath_Input.setBounds350,220,120,30。ScoreC_Clue.setBounds270,270
31、,80,30。ScoreC_Clue.setFontnewCommonFont 。ScoreC_Input.setBounds350,270,120,30。ScoreVC_Clue.setBounds270,320,80,30。ScoreVC_Clue.setFontnewCommonFont。ScoreVC_Input.setBounds350,320,120,30。ScoreJAVA_Clue.setBounds270,370,80,30。ScoreJAVA_Clue.setFontnewCommonFont。ScoreJAVA_Input.setBounds350,370,120,30。
32、Query_ScoreInformation.setBounds80,120,130,30。Query_ScoreInformation.setFontnewSubMenuFont。Query_ScoreInformation.addActionListenerthis。可编辑资料 - - - 欢迎下载精品名师归纳总结ScoreShowClue.setFontnewSubMenuFont 。ScoreShowClue.setBounds80,180,300,50。ScoreShow.setFontnewSubMenuFont 。ScoreShow.setBounds80,220,530,100
33、。Del_ScoreInformation.setBounds80,120,130,30。Del_ScoreInformation.setFontnewSubMenuFont。Del_ScoreInformation.addActionListenerthis。Add_ScoreInformation.setBounds80,170,130,30。Add_ScoreInformation.setFontnewSubMenuFont。Add_ScoreInformation.addActionListenerthis。Modify_ScoreInformation.setBounds80,220
34、,130,30。Modify_ScoreInformation.setFontnewSubMenuFont。Modify_ScoreInformation.addActionListenerthis。addScoreSno_Clue 。addScoreSno_Input。addScoreEnglish_Clue。addScoreEnglish_Input。addScoreSeniorMath_Clue。addScoreC_Clue 。addScoreSeniorMath_Input。addScoreC_Input。addScoreVC_Clue 。addScoreVC_Input。addSco
35、reJAVA_Clue 。addScoreJAVA_Input。addScoreShow 。addScoreShowClue 。addAdd_ScoreInformation。addDel_ScoreInformation。addQuery_ScoreInformation。addModify_ScoreInformation。public void actionPerformedActionEvent eife.getSource=Query_ScoreInformation/查询按纽大事触发处理可编辑资料 - - - 欢迎下载精品名师归纳总结ifMainMenu.myDatabase.Qu
36、eryScoreFunctionScoreSno_Input.getTextScoreShow.setText。ScoreShow.append 学号tt英语t高数tCtVCtJAVAn。ScoreShow.appendMainMenu.myDatabase.Student_ScoreMainMenu.my可编辑资料 - - - 欢迎下载精品名师归纳总结Database.NowScoreNum。elseScoreShow.setText。ScoreShow.setText对不起,没有你想要查找的同学信息 . 。ife.getSource=Add_ScoreInformation/增加同学成果信
37、息按纽的时间触发ifIsValidScoreScoreEnglish_Input.getText&IsValidScoreScor eSeniorMath_Input.getText&IsValidScoreScoreC_Input.getText&IsValidScoreScoreVC_Input.getText&IsValidScoreScoreJAVA_Input.getTextIsValidScoreScoreEnglish_Input.getText。int englishscore=ValidScore。IsValidScoreScoreSeniorMath_Input.getTe
38、xt。int seniorscore=ValidScore。IsValidScoreScoreC_Input.getText。int cscore=ValidScore。IsValidScoreScoreVC_Input.getText。 int vcscore=ValidScore。IsValidScoreScoreJAVA_Input.getText。int javascore=ValidScore。MainMenu.myDatabase.addStudentScoreInformationScoreSno_Inpu t.getText,englishscore,seniorscore,
39、cscore, vcscore, javascore。emptyInput。ife.getSource=Del_ScoreInformation/删除同学成果信息大事触发处理可编辑资料 - - - 欢迎下载精品名师归纳总结ifMainMenu.myDatabase.QueryScoreFunctionScoreSno_Input.getTextScoreShow.setText。ScoreShow.append 学号tt英语t高数tCtVCtJAVAn。ScoreShow.appendMainMenu.myDatabase.Student_ScoreMainMenu.my可编辑资料 - - -
40、 欢迎下载精品名师归纳总结Database.NowScoreNum。int result=JOptionPane.showConfirmDialognull,你真的要删除该同学的成果信息吗? ,Confirm Message,JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,thinker。ifresult=JOptionPane.YES_OPTION可编辑资料 - - - 欢迎下载精品名师归纳总结 。elseMainMenu.myDatabase.DelScoreFunctionScoreSno_Input.getText可编辑资料
41、 - - - 欢迎下载精品名师归纳总结ScoreShow.setText。ScoreShow.setText对不起,你要删除的同学成果信息不存在! 。ife.getSource=Modify_ScoreInformation/修改数据库中同学成果信息大事的触发ifIsValidScoreScoreEnglish_Input.getText&IsValidScoreScor eSeniorMath_Input.getText&IsValidScoreScoreC_Input.getText&IsValidScoreScoreVC_Input.getT ext&IsValidScoreScoreJ
42、AVA_Input.getTextIsValidScoreScoreEnglish_Input.getText。int englishscore=ValidScore。IsValidScoreScoreSeniorMath_Input.getText。int seniorscore=ValidScore。IsValidScoreScoreC_Input.getText。int cscore=ValidScore。IsValidScoreScoreVC_Input.getText。 int vcscore=ValidScore。IsValidScoreScoreJAVA_Input.getText。int javascore=ValidScore。MainM