您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 薪酬管理 > JAVA设计的学生管理系统源代码
//Student_Management_System.java//JHelpTextPanel.javaimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.event.*;importjava.io.*;//定义帮助文档类classJHelpTextPanelextendsJPanel{FontnewSmallTitleFont=newFont(楷体,Font.BOLD,12);JTextAreaHelpText=newJTextArea();JHelpTextPanel(){setLayout(null);setBackground(Color.orange);HelpText.setBackground(Color.orange);HelpText.setForeground(Color.red);HelpText.setFont(newSmallTitleFont);HelpText.setBounds(0,0,600,600);add(HelpText);}}//Student_InforPanel.javaimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.event.*;importjava.io.*;classStudent_InforPanelextendsJPanelimplementsActionListener{//四种常用字体的定义FontnewTitleFont=newFont(楷体,Font.BOLD,40);FontnewSmallTitleFont=newFont(楷体,Font.BOLD,25);FontnewCommonFont=newFont(宋体,Font.BOLD,20);FontnewSubMenuFont=newFont(宋体,Font.BOLD,15);FontNewSubMenuFont=newFont(宋体,Font.BOLD,10);//性别数组定义Stringos[]={男,女};//定义确认对话框图标ImageIconthinker=newImageIcon(ICON//thinker.gif);//定义学生信息管理系统面板菜单控件JLabelStudentSno_Clue=newJLabel(学号:);JLabelStudentName_Clue=newJLabel(姓名:);JLabelStudentSex_Clue=newJLabel(性别:);JLabelStudentAge_Clue=newJLabel(年龄:);JLabelStudentClass_Clue=newJLabel(班级:);JLabelStudentDept_Clue=newJLabel(系别:);JTextFieldStudentSno_Input=newJTextField();JTextFieldStudentName_Input=newJTextField();ComboBoxModelOthermode=newOtherAModel();JComboBoxStudentSex_Input=newJComboBox(Othermode);JTextFieldStudentAge_Input=newJTextField();JTextFieldStudentClass_Input=newJTextField();JTextFieldStudentDept_Input=newJTextField();JTextAreaQueryInforShow=newJTextArea();JLabelQueryClue=newJLabel(以下是你要查询的学生信息:);JButtonAdd_StudentInformation=newJButton(增加学生信息);JButtonDel_StudentInformation=newJButton(删除学生信息);JButtonQuery_StudentInformation=newJButton(查询学生信息);JButtonModify_StudentInformation=newJButton(修改学生信息);//定义变量intValidAge;StringSnoOrigin;Student_InforPanel(){setBackground(Color.orange);QueryInforShow.setBackground(Color.orange);setLayout(null);StudentSno_Clue.setBounds(270,120,80,30);StudentSno_Clue.setFont(newCommonFont);StudentSno_Input.setBounds(350,120,120,30);StudentName_Clue.setBounds(270,170,80,30);StudentName_Clue.setFont(newCommonFont);StudentName_Input.setBounds(350,170,120,30);StudentSex_Clue.setBounds(270,220,80,30);StudentSex_Clue.setFont(newCommonFont);StudentSex_Input.setBounds(350,220,120,30);StudentAge_Clue.setBounds(270,270,80,30);StudentAge_Clue.setFont(newCommonFont);StudentAge_Input.setBounds(350,270,120,30);StudentClass_Clue.setBounds(270,320,80,30);StudentClass_Clue.setFont(newCommonFont);StudentClass_Input.setBounds(350,320,120,30);StudentDept_Clue.setBounds(270,370,80,30);StudentDept_Clue.setFont(newCommonFont);StudentDept_Input.setBounds(350,370,120,30);Query_StudentInformation.setBounds(80,120,130,30);Query_StudentInformation.setFont(newSubMenuFont);Query_StudentInformation.addActionListener(this);QueryClue.setBounds(80,180,300,50);QueryClue.setFont(newSubMenuFont);QueryInforShow.setBounds(80,220,530,100);QueryInforShow.setFont(newSubMenuFont);Del_StudentInformation.setBounds(80,120,130,30);Del_StudentInformation.setFont(newSubMenuFont);Del_StudentInformation.addActionListener(this);Add_StudentInformation.setBounds(80,170,130,30);Add_StudentInformation.setFont(newSubMenuFont);Add_StudentInformation.addActionListener(this);Modify_StudentInformation.setBounds(80,220,130,30);Modify_StudentInformation.setBounds(80,220,130,30);Modify_StudentInformation.setFont(newSubMenuFont);Modify_StudentInformation.addActionListener(this);add(StudentSno_Clue);add(StudentSno_Input);add(StudentName_Clue);add(StudentName_Input);add(StudentSex_Clue);add(StudentSex_Input);add(StudentAge_Clue);add(StudentAge_Input);add(StudentClass_Clue);add(StudentClass_Input);add(StudentDept_Clue);add(StudentDept_Input);add(QueryClue);add(QueryInforShow);add(Add_StudentInformation);add(Del_StudentInformation);add(Query_StudentInformation);add(Modify_StudentInformation);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==Add_StudentInformation){if(IsValidAge(StudentAge_Input.getText())){String***=(String)StudentSex_Input.getSelectedItem();MainMenu.myDatabase.Add_Database_Information(StudentSno_Input.getText(),StudentName_Input.getText(),***,ValidAge,StudentClass_Input.getText(),StudentDept_Input.getText());emptyInput();}}if(e.getSource()==Del_StudentInformation){QueryInforShow.setText();if(MainMenu.myDatabase.Query_Database_Information(StudentSno_Input.getText())){QueryInforShow.setText(DataBaseControl.temptInformation);intresult=JOptionPane.showConfirmDialog(null,你确定要删除该生信息吗?,ConfirmMessage,JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,thinker);if(result==JOptionPane.YES_OPTION){if(MainMenu.myDatabase.Del_Database_Information(StudentSno_Input.getText()))JOptionPane.showMessageDialog(null,删除操作成功!,HappyMessage,JOptionPane.PLAIN_MESSAGE);elseJOptionPane.showMessageDialog(null,数据库操作出现异常,删除操作失败!,ErrorMessage,JOptionPane.ERROR_MESSAGE);}}elseQueryInforShow.setText(对不起,没有找到你要删除的学生信息.);}if(e.getSource()==Query_Studen
本文标题:JAVA设计的学生管理系统源代码
链接地址:https://www.777doc.com/doc-4376484 .html