Java课程设计-学籍管理系统代码 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《Java课程设计-学籍管理系统代码 .pdf》由会员分享,可在线阅读,更多相关《Java课程设计-学籍管理系统代码 .pdf(40页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
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 JPanel Font newSmallTitleFont=new Font(楷体,Font.BOLD,12);JTextArea HelpText=new JTextArea();JHelpTextPane
2、l()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.java import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax
3、.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);名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 40 页 -Font newSubMenuFo
4、nt=new Font(宋体,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 St
5、udentAge_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);JTex
6、tField StudentAge_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=
7、new JButton(删除学生信息);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,
8、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);名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 40 页 -StudentSex_Clue.setBounds(270,220,80,30);Stu
9、dentSex_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_I
10、nput.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(t
11、his);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_
12、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_Stu
13、dentInformation.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_I
14、nput);add(QueryClue);名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 40 页 -add(QueryInforShow);add(Add_StudentInformation);add(Del_StudentInformation);add(Query_StudentInformation);add(Modify_StudentInformation);public void actionPerformed(ActionEvent e)if(e.getSource()=Add_StudentInformation)if(IsValidAge(StudentAg
15、e_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)QueryInforS
16、how.setText();if(MainMenu.myDatabase.Query_Database_Information(StudentSno_Input.getText()QueryInforShow.setText(DataBaseControl.temptInformation);int result=JOptionPane.showConfirmDialog(null,你确定要删除该生信息吗?,Confirm Message,JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,thinker);if(result=JOpt
17、ionPane.YES_OPTION)if(MainMenu.myDatabase.Del_Database_Information(StudentSno_Input.getText()JOptionPane.showMessageDialog(null,删除操作成功!,Happy Message,JOptionPane.PLAIN_MESSAGE);else JOptionPane.showMessageDialog(null,数据库操作出现异常,删除操作失败!,Error Message,JOptionPane.ERROR_MESSAGE);else QueryInforShow.setT
18、ext(对不起,没有找到你要删除的学生信名师资料总结-精品资料欢迎下载-名师精心整理-第 4 页,共 40 页 -息.);if(e.getSource()=Query_StudentInformation)QueryInforShow.setText();if(MainMenu.myDatabase.Query_Database_Information(StudentSno_Input.getText()QueryInforShow.setText(DataBaseControl.temptInformation);else QueryInforShow.setText(对不起,没有你想要查询
19、的学生信息);if(e.getSource()=Modify_StudentInformation)if(IsValidAge(StudentAge_Input.getText()MainMenu.myDatabase.Modify_Database_Information(SnoOrigin,StudentSno_Input.getText(),StudentName_Input.getText(),ValidAge,StudentClass_Input.getText(),StudentDept_Input.getText();public boolean IsValidAge(Strin
20、g StringAge)try ValidAge=Integer.parseInt(StringAge);catch(NumberFormatException e)e.printStackTrace();return false;if(ValidAge0)return true;else JOptionPane.showMessageDialog(null,你输入的年龄不合实际情况n请重新输入!,WARNING MESSAGE,JOptionPane.WARNING_MESSAGE);return false;名师资料总结-精品资料欢迎下载-名师精心整理-第 5 页,共 40 页 -clas
21、s OtherAModel extends DefaultComboBoxModel OtherAModel()for(int i=0;i100|ValidScoreMaxNum)break;Information=s1.getString(1)+t+s1.getString(2)+t+s1.getString(3)+t+s1.getLong(4)+t+s1.getString(5)+t+s1.getString(6)+n;Student_Informationi=Information;i+;NowInformationNum=i;Close_database();catch(SQLExce
22、ption e)System.out.println(e.toString();public boolean Query_Database_Information(String sno)/显示查询数据库中学生信息 if(ConnectDataBase()try str=select*from Student_Basic_Information where 学号=+sno+;名师资料总结-精品资料欢迎下载-名师精心整理-第 18 页,共 40 页 -ResultSet s1=st1.executeQuery(str);int i=0;while(s1.next()temptInformation
23、=s1.getString(1)+t+s1.getString(2)+t+s1.getString(3)+t+s1.getLong(4)+t+s1.getString(5)+t+s1.getString(6)+n;i+;Close_database();if(i0)return true;catch(SQLException e)e.printStackTrace();return false;return false;public void Add_Database_Information(String sno,String name,String*,int age,String class
24、name,String dept)/向数据库中加入新生的基本信息if(ConnectDataBase()try str=INSERT INTO Student_Basic_Information+(学号,姓名,性别,年龄,班级,系别);str=str+VALUES(+sno+,+name+,+*+,+age+,+classname+,+dept+);st1.executeUpdate(str);Close_database();catch(SQLException e)e.printStackTrace();return;JOptionPane.showMessageDialog(null,加
25、入新生记录操作成功!,HAPPY MESSAGE,JOptionPane.PLAIN_MESSAGE);名师资料总结-精品资料欢迎下载-名师精心整理-第 19 页,共 40 页 -public boolean Del_Database_Information(String sno)/删除数据库中某个学生的基本信息 if(ConnectDataBase()try str=DELETE FROM Student_Basic_Information WHERE 学号=+sno+;st1.executeUpdate(str);Close_database();catch(SQLException e)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Java课程设计-学籍管理系统代码 2022 Java 课程设计 学籍 管理 系统 代码
![提示](https://www.deliwenku.com/images/bang_tan.gif)
限制150内