1、JAVA设计方案的学生管理系统源代码/Student_Management_System.java/JHelpTextPanel.javaimport java.awt.*。import java.awt.event.*。import javax.swing.*。import javax.swing.event.*。import java.io.*。/定义帮助文档类class JHelpTextPanel extends JPanelFont newSmallTitleFont=new Font(楷体,Font.BOLD,12)。JTextArea HelpText=new JTextArea
2、()。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 .javaimport java.awt.*。import java.awt.event.*。import jav
3、ax.swing.*。import javax.swing.event.*。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(宋体,
4、Font.BOLD,15)。Font NewSubMenuFont=new Font(宋体,Font.BOLD,10)。/性别数组定义String os= 男 , 女 。 /定义确认对话框图标ImageIcon thinker=new ImageIcon(ICON/thinker.gif)。 /定义学生信息管理系统面板菜单控件JLabel StudentSno_Clue=new JLabel(学号:)。JLabel StudentName_Clue=new JLabel(姓名:)。JLabel StudentSex_Clue=new JLabel(性别:)。JLabel StudentAge_
5、Clue=new JLabel(年龄:)。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 JComboBox(Othermode)。JTextField St
6、udentAge_Input=new JTextField()。JTextField 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 JBut
7、ton(删除学生信息)。JButton Query_StudentInformation=new JButton(查询学生信息)。 JButton Modify_StudentInformation=new JButton(修改学生信息)。 /定义变量 int ValidAge。 String SnoOrigin。 Student_InforPanel() setBackground(Color.orange)。QueryInforShow.setBackground(Color.orange)。setLayout(null)。StudentSno_Clue.setBounds(270,120
8、,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)。Stud
9、entSex_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)。StudentDe
10、pt_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)。
11、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
12、,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)
13、。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(QueryInforSho
14、w)。add(Add_StudentInformation)。add(Del_StudentInformation)。add(Query_StudentInformation)。 add(Modify_StudentInformation)。public void actionPerformed(ActionEvent e) if(e.getSource()=Add_StudentInformation) if(IsValidAge(StudentAge_Input.getText() String *=(String)StudentSex_Input.getSelectedItem()。 M
15、ainMenu.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(
16、StudentSno_Input.getText() QueryInforShow.setText(DataBaseControl.temptInformation)。 int result=JOptionPane.showConfirmDialog(null,你确定要删除该生信息吗?,Confirm Message,JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,thinker)。 if(result=JOptionPane.YES_OPTION) if(MainMenu.myDatabase.Del_Database_Infor
17、mation(StudentSno_Input.getText() JOptionPane.showMessageDialog(null,删除操作成功!,Happy Message,JOptionPane.PLAIN_MESSAGE)。 else JOptionPane.showMessageDialog(null,数据库操作出现异常,删除操作失败!,Error Message,JOptionPane.ERROR_MESSAGE)。 else QueryInforShow.setText(对不起,没有找到你要删除的学生信息.)。 if(e.getSource()=Query_StudentIn
18、formation) QueryInforShow.setText()。 if(MainMenu.myDatabase.Query_Database_Information(StudentSno_Input.getText() QueryInforShow.setText(DataBaseControl.temptInformation)。 else QueryInforShow.setText(对不起,没有你想要查询的学生信息)。 if(e.getSource()=Modify_StudentInformation) if(IsValidAge(StudentAge_Input.getTex
19、t() MainMenu.myDatabase.Modify_Database_Information(SnoOrigin,StudentSno_Input.getText(), StudentName_Input.getText(),ValidAge,StudentClass_Input.getText(),StudentDept_Input.getText()。 public boolean IsValidAge(String StringAge) try ValidAge=Integer.parseInt(StringAge)。catch(NumberFormatException e)
20、 e.printStackTrace()。 return false。if(ValidAge0) return true。else JOptionPane.showMessageDialog(null,你输入的年龄不合实际情况n请重新输入!,WARNING MESSAGE, JOptionPane.WARNING_MESSAGE)。 return false。 class OtherAModel extends DefaultComboBoxModel OtherAModel() for(int i=0。ios.length。i+) addElement(osi)。 public void e
21、mptyInput() StudentSno_Input.setText()。 StudentAge_Input.setText()。 StudentName_Input.setText()。 StudentClass_Input.setText()。 StudentDept_Input.setText()。 public void OnlyShowSno() StudentSno_Clue.setVisible(true)。 StudentSno_Input.setVisible(true)。 StudentSno_Input.setText()。 QueryClue.setVisible(
22、true)。 QueryInforShow.setVisible(true)。 StudentName_Clue.setVisible(false)。 StudentName_Input.setVisible(false)。 StudentSex_Clue.setVisible(false)。 StudentSex_Input.setVisible(false)。 StudentAge_Clue.setVisible(false)。 StudentAge_Input.setVisible(false)。 StudentClass_Clue.setVisible(false)。 StudentC
23、lass_Input.setVisible(false)。 StudentDept_Clue.setVisible(false)。 StudentDept_Input.setVisible(false)。 /显示学生信息的所有面板控件 public void ShowWhole() StudentSno_Clue.setVisible(true)。 StudentSno_Input.setVisible(true)。 StudentSno_Input.setText()。 QueryClue.setVisible(false)。 QueryInforShow.setVisible(false)
24、。 StudentName_Clue.setVisible(true)。 StudentName_Input.setVisible(true)。 StudentName_Input.setText()。 StudentSex_Clue.setVisible(true)。 StudentSex_Input.setVisible(true)。 StudentAge_Clue.setVisible(true)。 StudentAge_Input.setVisible(true)。 StudentAge_Input.setText()。 StudentClass_Clue.setVisible(tru
25、e)。 StudentClass_Input.setVisible(true)。 StudentClass_Input.setText()。 StudentDept_Clue.setVisible(true)。 StudentDept_Input.setVisible(true)。 StudentDept_Input.setText()。 /Student_ScorePanel.javaimport java.awt.*。import java.awt.event.*。import javax.swing.*。import javax.swing.event.*。class Student_S
26、corePanel 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 NewSubMenuFont=new Font(宋体,Font.BOLD,10)。 /定义确认对话框图
27、标ImageIcon thinker=new ImageIcon(ICON/thinker.gif)。JLabel ScoreSno_Clue=new JLabel(学号:)。JLabel ScoreEnglish_Clue=new JLabel(英语:)。JLabel ScoreSeniorMath_Clue=new JLabel(高数:)。JLabel ScoreC_Clue=new JLabel(C:)。JLabel ScoreVC_Clue=new JLabel(VC:)。JLabel ScoreJAVA_Clue=new JLabel(JAVA:)。JTextField ScoreS
28、no_Input=new JTextField()。JTextField 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 Add_ScoreInformation=new JButton(增加学生成绩)。JButton Del_ScoreInformation=new JButton(删除学生成绩)。JButton Query_ScoreInformation=new JB
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1