《2022年JAVA学生管理源代码.docx》由会员分享,可在线阅读,更多相关《2022年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;JHelpTextP
2、anelsetLayoutnull;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.event
3、.*;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 ;Font NewSubMen
4、uFont=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年龄: ;JLabel StudentCl
5、ass_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;JTextField Studen
6、tClass_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_StudentInformation=new JButton查询
7、同学信息 ;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_Input.setBounds350,
8、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_Clue.setBounds270,270,80,30;St
9、udentAge_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.setFontnewCommonFont ;StudentDept_Input.set
10、Bounds350,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;QueryInforShow.setFontnewSubMenu
11、Font;Del_StudentInformation.setBounds80,120,130,30;Del_StudentInformation.setFontnewSubMenuFont;Del_StudentInformation.addActionListenerthis;Add_StudentInformation.setBounds80,170,130,30;Add_StudentInformation.setFontnewSubMenuFont;Add_StudentInformation.addActionListenerthis;Modify_StudentInformati
12、on.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_Clue ;addStudentSex_Input;addStu
13、dentAge_Clue ;addStudentAge_Input;addStudentClass_Clue;addStudentClass_Input;addStudentDept_Clue;addStudentDept_Input;欢迎下载精品学习资源addQueryClue ;addQueryInforShow ;addAdd_StudentInformation;addDel_StudentInformation;addQuery_StudentInformation;addModify_StudentInformation;public void actionPerformedAct
14、ionEvent eife.getSource=Add_StudentInformationifIsValidAgeStudentAge_Input.getTextString *=StringStudentSex_Input.getSelectedItem;MainMenu.myDatabase.Add_Database_InformationStudentSno_Input.ge tText,StudentName_Input.getText,*,ValidAge,StudentClass_Input.getT ext,StudentDept_Input.getText;emptyInpu
15、t;ife.getSource=Del_StudentInformationQueryInforShow.setText;ifMainMenu.myDatabase.Query_Database_InformationStuden tSno_Input.getTextQueryInforShow.setTextDataBaseControl.temptInformation;int result=JOptionPane.showConfirmDialognull,你确定要删除该生信息吗? ,ConfirmMessage,JOptionPane.YES_NO_OPTION,JOptionPane
16、.QUESTION_MESSAGE,think er ;ifresult=JOptionPane.YES_OPTIONifMainMenu.myDatabase.Del_Database_InformationSt udentSno_Input.getTextJOptionPane.showMessageDialognull,删除操作成功!,Happy Message,JOptionPane.PLAIN_MESSAGE;elseJOptionPane.showMessageDialognull,数据库操作显现反常,删除操作失败! ,Error Message,JOptionPane.ERROR
17、_MESSAGE;else欢迎下载精品学习资源息. ;QueryInforShow.setText对不起,没有找到你要删除的同学信欢迎下载精品学习资源ife.getSource=Query_StudentInformationQueryInforShow.setText;ifMainMenu.myDatabase.Query_Database_InformationStud entSno_Input.getTextQueryInforShow.setTextDataBaseControl.temptInformatio欢迎下载精品学习资源n ;信息 ;elseQueryInforShow.se
18、tText对不起,没有你想要查询的同学欢迎下载精品学习资源ife.getSource=Modify_StudentInformationifIsValidAgeStudentAge_Input.getTextMainMenu.myDatabase.Modify_Database_InformationSnoOri gin,StudentSno_Input.getText,StudentName_Input.getText,ValidAge,StudentClass_Inpu t.getText,StudentDept_Input.getText;欢迎下载精品学习资源trypublic bool
19、ean IsValidAgeString StringAgeValidAge=Integer.parseIntStringAge;欢迎下载精品学习资源catchNumberFormatException ee.printStackTrace;return false;ifValidAge0 return true;elseJOptionPane.showMessageDialognull,你输入的年龄不合实际情形 n请重新输入 .,WARNING MESSAGE,JOptionPane.WARNING_MESSAG;E return false;欢迎下载精品学习资源class OtherAMo
20、del extends DefaultComboBoxModelOtherAModelforint i=0;ios.length;i+ addElementosi;public void emptyInputStudentSno_Input.setText;StudentAge_Input.setText;StudentName_Input.setText;StudentClass_Input.setText;StudentDept_Input.setText;public void OnlyShowSnoStudentSno_Clue.setVisibletrue;StudentSno_In
21、put.setVisibletrue;StudentSno_Input.setText;QueryClue.setVisibletrue;QueryInforShow.setVisibletrue;StudentName_Clue.setVisiblefalse;StudentName_Input.setVisiblefalse;StudentSex_Clue.setVisiblefalse;StudentSex_Input.setVisiblefalse;StudentAge_Clue.setVisiblefalse;StudentAge_Input.setVisiblefalse;Stud
22、entClass_Clue.setVisiblefalse;StudentClass_Input.setVisiblefalse;StudentDept_Clue.setVisiblefalse;StudentDept_Input.setVisiblefalse;/显示同学信息的全部面板控件public void ShowWholeStudentSno_Clue.setVisibletrue;StudentSno_Input.setVisibletrue;StudentSno_Input.setText;QueryClue.setVisiblefalse;欢迎下载精品学习资源QueryInfo
23、rShow.setVisiblefalseStudentName_Clue.setVisibletrue;StudentName_Input.setVisibletrue;StudentName_Input.setText;StudentSex_Clue.setVisibletrue;StudentSex_Input.setVisibletrue;StudentAge_Clue.setVisibletrue;StudentAge_Input.setVisibletrue;StudentAge_Input.setText;StudentClass_Clue.setVisibletrue;Stud
24、entClass_Input.setVisibletrueStudentClass_Input.setText;StudentDept_Clue.setVisibletrue;StudentDept_Input.setVisibletrue;StudentDept_Input.setText;/Student_ScorePanel.javaimport java.awt.*; import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;class Student_ScorePanel extends JPane
25、l 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 ;Font NewSubMenuFont=new Font 宋体,Font.BOLD,10 ;/定义确认对话框图标ImageIcon thinker=new Ima
26、geIconICON/thinker.gif;JLabel ScoreSno_Clue=new JLabel学号: ;JLabel ScoreEnglish_Clue=new JLabel英语: ;JLabel ScoreSeniorMath_Clue=new JLabel高数: ;JLabel ScoreC_Clue=new JLabelC:;JLabel ScoreVC_Clue=new JLabelVC:;JLabel ScoreJAVA_Clue=new JLabelJAVA:;欢迎下载精品学习资源JTextField ScoreSno_Input=new JTextField;JTe
27、xtField ScoreEnglish_Input=new JTextField;JTextField ScoreSeniorMath_Input=new JTextField;JTextField ScoreC_Input=new JTextField; JTextField ScoreVC_Input=new JTextField;JTextField ScoreJAVA_Input=new JTextField;JTextArea ScoreShow=new JTextArea;JLabel ScoreShowClue=new JLabel你要查询的同学成果信息为 : ;JButton
28、 Add_ScoreInformation=new JButton增加同学成果 ;JButton Del_ScoreInformation=new JButton删除同学成果 ;JButton Query_ScoreInformation=new JButton查询同学成果 ;JButton Modify_ScoreInformation=new JButton修改同学成果 ;/定义变量int ValidScore;String ScoreSno;Student_ScorePanel/ 同学成果治理面板设置控件setBackgroundColor.orange;ScoreShow.setBac
29、kgroundColor.orange;setLayoutnull;ScoreSno_Clue.setBounds270,120,80,30;ScoreSno_Clue.setFontnewCommonFont ;ScoreSno_Input.setBounds350,120,120,30;ScoreEnglish_Clue.setBounds270,170,80,30;ScoreEnglish_Clue.setFontnewCommonFont;ScoreEnglish_Input.setBounds350,170,120,30;ScoreSeniorMath_Clue.setBounds2
30、70,220,80,30;ScoreSeniorMath_Clue.setFontnewCommonFont ;ScoreSeniorMath_Input.setBounds350,220,120,30;ScoreC_Clue.setBounds270,270,80,30;ScoreC_Clue.setFontnewCommonFont ;ScoreC_Input.setBounds350,270,120,30;ScoreVC_Clue.setBounds270,320,80,30;ScoreVC_Clue.setFontnewCommonFont;ScoreVC_Input.setBound
31、s350,320,120,30;ScoreJAVA_Clue.setBounds270,370,80,30;ScoreJAVA_Clue.setFontnewCommonFont;ScoreJAVA_Input.setBounds350,370,120,30;Query_ScoreInformation.setBounds80,120,130,30;Query_ScoreInformation.setFontnewSubMenuFont;Query_ScoreInformation.addActionListenerthis;欢迎下载精品学习资源ScoreShowClue.setFontnew
32、SubMenuFont ;ScoreShowClue.setBounds80,180,300,50;ScoreShow.setFontnewSubMenuFont ;ScoreShow.setBounds80,220,530,100;Del_ScoreInformation.setBounds80,120,130,30;Del_ScoreInformation.setFontnewSubMenuFont;Del_ScoreInformation.addActionListenerthis;Add_ScoreInformation.setBounds80,170,130,30;Add_Score
33、Information.setFontnewSubMenuFont;Add_ScoreInformation.addActionListenerthis;Modify_ScoreInformation.setBounds80,220,130,30;Modify_ScoreInformation.setFontnewSubMenuFont;Modify_ScoreInformation.addActionListenerthis;addScoreSno_Clue ;addScoreSno_Input;addScoreEnglish_Clue;addScoreEnglish_Input;addSc
34、oreSeniorMath_Clue;addScoreC_Clue ;addScoreSeniorMath_Input;addScoreC_Input;addScoreVC_Clue ;addScoreVC_Input;addScoreJAVA_Clue ;addScoreJAVA_Input;addScoreShow ;addScoreShowClue ;addAdd_ScoreInformation;addDel_ScoreInformation;addQuery_ScoreInformation;addModify_ScoreInformation;public void actionP
35、erformedActionEvent eife.getSource=Query_ScoreInformation/查询按纽大事触发处理欢迎下载精品学习资源ifMainMenu.myDatabase.QueryScoreFunctionScoreSno_Input.getTextScoreShow.setText;ScoreShow.append 学号tt英语t高数tCtVCtJAVAn;ScoreShow.appendMainMenu.myDatabase.Student_ScoreMainMenu.my欢迎下载精品学习资源Database.NowScoreNum;elseScoreShow
36、.setText;ScoreShow.setText对不起,没有你想要查找的同学信息 . ;ife.getSource=Add_ScoreInformation/增加同学成果信息按纽的时间触发ifIsValidScoreScoreEnglish_Input.getText&IsValidScoreScor eSeniorMath_Input.getText&IsValidScoreScoreC_Input.getText&IsValidScoreScoreVC_Input.getText&IsValidScoreScoreJAVA_Input.getTextIsValidScoreScoreE
37、nglish_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;MainMenu
38、.myDatabase.addStudentScoreInformationScoreSno_Inpu t.getText,englishscore,seniorscore, cscore, vcscore, javascore;emptyInput;ife.getSource=Del_ScoreInformation/删除同学成果信息大事触发处理欢迎下载精品学习资源ifMainMenu.myDatabase.QueryScoreFunctionScoreSno_Input.getTextScoreShow.setText;ScoreShow.append 学号tt英语t高数tCtVCtJAV
39、An;ScoreShow.appendMainMenu.myDatabase.Student_ScoreMainMenu.my欢迎下载精品学习资源Database.NowScoreNum;int result=JOptionPane.showConfirmDialognull,你真的要删除该同学的成果信息吗? ,Confirm Message,JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,thinker;ifresult=JOptionPane.YES_OPTION欢迎下载精品学习资源 ;elseMainMenu.myDataba
40、se.DelScoreFunctionScoreSno_Input.getText欢迎下载精品学习资源ScoreShow.setText;ScoreShow.setText对不起,你要删除的同学成果信息不存在! ;ife.getSource=Modify_ScoreInformation/修改数据库中同学成果信息大事的触发ifIsValidScoreScoreEnglish_Input.getText&IsValidScoreScor eSeniorMath_Input.getText&IsValidScoreScoreC_Input.getText&IsValidScoreScoreVC_I
41、nput.getT ext&IsValidScoreScoreJAVA_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;Is
42、ValidScoreScoreJAVA_Input.getText;int javascore=ValidScore;MainMenu.myDatabase.ModifyStudentScoreInformationScor eSno_Input.getText,ScoreSno,englishscore,seniorscore, cscore, vcscore,欢迎下载精品学习资源javascore;emptyInput;欢迎下载精品学习资源public boolean IsValidScoreString stringAge/判定成果输入是否合法tryValidScore=Integer.parseIntstringAge;catchNumberFormatException e欢迎下载精品学习资源JOptionPane.showMessageDialognull,成果输入中含有非