java课程设计学生信息管理系统_第1页
java课程设计学生信息管理系统_第2页
java课程设计学生信息管理系统_第3页
java课程设计学生信息管理系统_第4页
java课程设计学生信息管理系统_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

JavaJava 程序设计程序设计 课程设计课程设计 目目 录录 一 一 总体设计总体设计 1 1 学生信息系统结构图学生信息系统结构图 1 1 21 2 本系统的主要功能本系统的主要功能 2 2 1 3 Java 源文件及其功能源文件及其功能 2 二二 详细设计详细设计 2 12 1 主类主类 StudentManagerStudentManager 3 3 2 22 2 类类 StudentSituationStudentSituation 5 5 2 32 3 类类 ModifySituationModifySituation 8 8 2 42 4 类类inquest 1010 2 52 5 类类 DeleteDelete 1212 2 62 6 类类 StudentStudent 13 13 三 功能测试及运行效果三 功能测试及运行效果 3 13 1 系统主界面系统主界面 15 15 3 23 2 录入信息界面录入信息界面 15 15 3 33 3 修改信息界面修改信息界面 1616 3 3 查询信息界面查询信息界面 16 3 3 删除信息界面删除信息界面 17 程序总结程序总结 17 17 参考文献参考文献 17 17 一 总体设计一 总体设计 1 1学生信息系统结构图学生信息系统结构图 学生信息管理系统学生信息管理系统 修改学生信息修改学生信息 查询学生信息查询学生信息 录入学生信息录入学生信息 删除学生信息删除学生信息 学生信息系统分析结构图学生信息系统分析结构图 1 21 2 本系统的主要功能本系统的主要功能 运行该系统成功后 会出现一个欢迎使用的主界面 上面的菜单选项 会弹出运行该系统成功后 会出现一个欢迎使用的主界面 上面的菜单选项 会弹出 4 4 个子菜单个子菜单 分别是录入基本信息 修改基本信息 查询基本信息 删除基本信息 点击它们会出现不分别是录入基本信息 修改基本信息 查询基本信息 删除基本信息 点击它们会出现不 同的界面 分别有不同的功能 同的界面 分别有不同的功能 1 1 1 1 StudentManager javaStudentManager java 该类负责创建学生信息管理系统的主窗口 该类还有该类负责创建学生信息管理系统的主窗口 该类还有 mainmain 方法 程序从该类开始执行 方法 程序从该类开始执行 2 2 StudentSituation javaStudentSituation java 该类创建的对象是该类创建的对象是 StudentManagerStudentManager 类的重要成员之一 负责提供录入 重置学生基本类的重要成员之一 负责提供录入 重置学生基本 信息的界面 信息的界面 3 3 ModifySituation javaModifySituation java 该类创建的对象是该类创建的对象是 StudentManagerStudentManager 类的重要成员之一 负责提供修改学生基本信息的类的重要成员之一 负责提供修改学生基本信息的 界面 界面 4 Delete java4 Delete java 该类创建的对象是该类创建的对象是 StudentManagerStudentManager 类的重要成员之一 负责提供删除学生基本信息的类的重要成员之一 负责提供删除学生基本信息的 界面 界面 5 5 inquest java java 创建的对象是创建的对象是 StudentManagerStudentManager 类的重要成员之一 该类负责提供查询学生基本信息的类的重要成员之一 该类负责提供查询学生基本信息的 界面 界面 录入学号录入学号 录入姓名录入姓名 录入专业录入专业 录入年级录入年级 出生日期出生日期 录入学号录入学号 修改姓名修改姓名 修改专业修改专业 修改年级修改年级 修改生日修改生日 查询学号查询学号 删除学号删除学号 显示姓名显示姓名 显示专业显示专业 显示年级显示年级 显示生日显示生日 删除姓名删除姓名 删除专业删除专业 删除年级删除年级 删除生日删除生日 6 Student java6 Student java 该类创建的对象是该类创建的对象是 StudentManagerStudentManager 类的重要成员之一 该类在做上面操作时可以返回类的重要成员之一 该类在做上面操作时可以返回 学生的基本信息 主要起到一个返回的作用 学生的基本信息 主要起到一个返回的作用 本系统是基于数据库的学生信息管理系统 实现了连接数据库 录入 修改 查询 删本系统是基于数据库的学生信息管理系统 实现了连接数据库 录入 修改 查询 删 除学生信息的功能 除学生信息的功能 1 3 Java 源文件及其功能源文件及其功能 1 icon jpg1 icon jpg 该文件是窗口最小化时的窗口图标 该文件是窗口最小化时的窗口图标 StudentSituationStudentSituation 需要调用该文件 需要调用该文件 2 2 专业专业 txt txt 该文件为专业组合的组合键提供下拉菜单的内容 该文件为专业组合的组合键提供下拉菜单的内容 StudentSituationStudentSituation 和和 ModifySituationModifySituation 调用该文件调用该文件 2 二 详细设计二 详细设计 2 12 1 主类主类 StudentManagerStudentManager 表 2 1 主要成员变量 属性 成员变量描述成员变量描述变量类型变量类型名称名称 面板 StudentSituation NULL 面板 ModifySituationNULL 面板inquest NULL 面板 Delete NULL 菜单栏 JMenuBarbar 菜单组 JMenufileMenu 菜单项 JMenuItem StudentSituation ModifySituation Inquest Delete 布局管理器 CardLayoutcard 表 2 2 主要方法 方法名称方法名称返回类型返回类型功能功能备注备注 StudentManager 无类型创建窗口构造方法 actionPerformed无类型处理响应事件继承自父类抽象方法 main无类型执行程序程序的主函数 源代码源代码StudentManagerStudentManager java java importimport java awt java awt importimport java awt event java awt event importimport javax swing javax swing importimport java io java io importimport java util Hashtable java util Hashtable publicpublic classclass StudentManagerStudentManager extendsextends JFrameJFrame implementsimplements ActionListenerActionListener StudentSituationStudentSituation 基本信息录入基本信息录入 null null ModifySituationModifySituation 基本信息修改基本信息修改 null null InquestInquest 基本信息查询基本信息查询 null null DeleteDelete 基本信息删除基本信息删除 null null JMenuBarJMenuBar bar bar JMenuJMenu fileMenu fileMenu JMenuItemJMenuItem 录入录入 修改修改 查询查询 删除删除 ContainerContainer con null con null HashtableHashtable 基本信息基本信息 null null FileFile file null file null CardLayoutCardLayout card null card null JLabelJLabel label null label null JPanelJPanel pCenter pCenter publicpublic StudentManager StudentManager 录入录入 new new JMenuItem JMenuItem 录入基本信息录入基本信息 3 3 修改修改 new new JMenuItem JMenuItem 修改基本信息修改基本信息 查询查询 new new JMenuItem JMenuItem 查询基本信息查询基本信息 删除删除 new new JMenuItem JMenuItem 删除基本信息删除基本信息 bar newbar new JMenuBar JMenuBar fileMenu newfileMenu new JMenu JMenu 菜单选项菜单选项 fileMenu add fileMenu add 录入录入 fileMenu add fileMenu add 修改修改 fileMenu add fileMenu add 查询查询 fileMenu add fileMenu add 删除删除 bar add fileMenu bar add fileMenu setJMenuBar bar setJMenuBar bar label newlabel new JLabel welcomeJLabel welcome toto useuse studentsstudents system JLabel CENTER system JLabel CENTER label setFont newlabel setFont new Font Font 楷体楷体 Font BOLD Font BOLD 22 22 label setForeground Color black label setForeground Color black 基本信息基本信息 new new Hashtable Hashtable 录入录入 addActionListener this addActionListener this 修改修改 addActionListener this addActionListener this 查询查询 addActionListener this addActionListener this 删除删除 addActionListener this addActionListener this card newcard new CardLayout CardLayout con getContentPane con getContentPane pCenter newpCenter new JPanel JPanel pCenter setLayout card pCenter setLayout card file newfile new File File 基本信息基本信息 txt txt if file exists if file exists try try FileOutputStreamFileOutputStream out newout new FileOutputStream file FileOutputStream file ObjectOutputStreamObjectOutputStream objectOut newobjectOut new ObjectOutputStream out ObjectOutputStream out objectOut writeObject objectOut writeObject 基本信息基本信息 objectOut close objectOut close out close out close catch IOExceptioncatch IOException e e 基本信息录入基本信息录入 new new StudentSituation file StudentSituation file 基本信息修改基本信息修改 new new ModifySituation file ModifySituation file 基本信息查询基本信息查询 new new Inquest this file Inquest this file 基本信息删除基本信息删除 new new Delete file Delete file pCenter add pCenter add 欢迎语界面欢迎语界面 label label pCenter add pCenter add 录入界面录入界面 基本信息录入基本信息录入 pCenter add pCenter add 修改界面修改界面 基本信息修改基本信息修改 pCenter add pCenter add 删除界面删除界面 基本信息删除基本信息删除 con add pCenter BorderLayout CENTER con add pCenter BorderLayout CENTER con validate con validate addWindowListener newaddWindowListener new WindowAdapter WindowAdapter publicpublic voidvoid windowClosing WindowEventwindowClosing WindowEvent e e System exit 0 System exit 0 setVisible true setVisible true setBounds 100 50 420 380 setBounds 100 50 420 380 validate validate publicpublic voidvoid actionPerformed ActionEventactionPerformed ActionEvent e e if e getSource if e getSource 录入录入 card show pCenter card show pCenter 录入界面录入界面 elseelse if e getSource if e getSource 修改修改 card show pCenter card show pCenter 修改界面修改界面 4 4 elseelse if e getSource if e getSource 查询查询 基本信息查询基本信息查询 setVisible true setVisible true elseelse if e getSource if e getSource 删除删除 card show pCenter card show pCenter 删除界面删除界面 publicpublic staticstatic voidvoid main Stringmain String args args newnew StudentManager StudentManager 2 22 2 类类 StudentSituationStudentSituation 表 2 3 主要成员变量 成员变量描述成员变量描述变量类型变量类型名称名称 Hashtable 对象类型 Hashtable NULL 文本域 JTextField 学号 姓名 专业 年级 出生 组合框 JComboBoxSmajor 单选框 ButtonGroup 男 女 按钮多斥作用域 ButtonGroupgroup 按钮 JButton 录入 重置 表 2 4 主要方法 方法名称方法名称 返回类返回类 型型 功能功能备注备注 StudentSituation 无类型创建录入学生信息界面构造方法 actionPerformed无类型处理响应事件继承自父类抽象方法 源代码源代码StudentSituationStudentSituation java java import java awt import java awt event import javax swing import java io import java util public class StudentSituation extends JPanel implements ActionListener Hashtable 基本信息表基本信息表 null JTextField 学号学号 姓名姓名 专业专业 年级年级 出生出生 JRadioButton 男男 女女 Student 学生学生 null ButtonGroup group null JButton 录入录入 重置重置 FileInputStream inOne null 5 ObjectInputStream inTwo null FileOutputStream outOne null ObjectOutputStream outTwo null File file null public StudentSituation File file this file file 学号学号 new JTextField 10 姓名姓名 new JTextField 10 专业专业 new JTextField 10 年级年级 new JTextField 10 出生出生 new JTextField 10 group new ButtonGroup 男男 new JRadioButton 男男 true 女女 new JRadioButton 女女 false group add 男男 group add 女女 录入录入 new JButton 录入录入 重置重置 new JButton 重置重置 录入录入 addActionListener this 重置重置 addActionListener this Box box1 Box createHorizontalBox box1 add new JLabel 学号学号 JLabel CENTER box1 add 学号学号 Box box2 Box createHorizontalBox box2 add new JLabel 姓名姓名 JLabel CENTER box2 add 姓名姓名 Box box3 Box createHorizontalBox box3 add new JLabel 性别性别 JLabel CENTER box3 add 男男 box3 add 女女 Box box4 Box createHorizontalBox box4 add new JLabel 专业专业 JLabel CENTER box4 add 专业专业 Box box5 Box createHorizontalBox box5 add new JLabel 年级年级 JLabel CENTER box5 add 年级年级 Box box6 Box createHorizontalBox box6 add new JLabel 出生出生 JLabel CENTER box6 add 出生出生 Box boxH Box createVerticalBox boxH add box1 boxH add box2 boxH add box3 boxH add box4 boxH add box5 boxH add box6 boxH add Box createVerticalGlue JPanel pCenter new JPanel pCenter add boxH setLayout new BorderLayout add pCenter BorderLayout CENTER JPanel pSouth new JPanel pSouth add 录入录入 pSouth add 重置重置 add pSouth BorderLayout SOUTH validate public void actionPerformed ActionEvent e 6 if e getSource 录入录入 String number number 学号学号 getText if number length 0 try inOne new FileInputStream file inTwo new ObjectInputStream inOne 基本信息表基本信息表 Hashtable inTwo readObject inOne close inTwo close catch Exception ee if 基本信息表基本信息表 containsKey number String warning 该生基本信息已存在该生基本信息已存在 请到修改页面修改请到修改页面修改 JOptionPane showMessageDialog this warning 警告警告 JOptionPane WARNING MESSAGE else String m 基本信息将被录入基本信息将被录入 int ok JOptionPane showConfirmDialog this m 确认确认 JOptionPane YES NO OPTION JOptionPane INFORMATION MESSAGE if ok JOptionPane YES OPTION String name 姓名姓名 getText String discipling 专业专业 getText String grade 年级年级 getText String borth 出生出生 getText String sex null if 男男 isSelected sex 男男 getText else sex 女女 getText 学生学生 new Student 学生学生 setNumber number 学生学生 setName name 学生学生 setDiscipling discipling 学生学生 setGrade grade 学生学生 setBorth borth 学生学生 setSex sex try outOne new FileOutputStream file outTwo new ObjectOutputStream outOne 基本信息表基本信息表 put number 学生学生 outTwo writeObject 基本信息表基本信息表 outTwo close outOne close 学号学号 setText null 7 姓名姓名 setText null 专业专业 setText null 年级年级 setText null 出生出生 setText null catch Exception ee System out println ee else String warning 必须要输入学号必须要输入学号 JOptionPane showMessageDialog this warning 警告警告 JOptionPane WARNING MESSAGE if e getSource 重置重置 学号学号 setText null 姓名姓名 setText null 专业专业 setText null 年级年级 setText null 出生出生 setText null 2 3 类类 ModifySituationModifySituation 表 2 5 主要成员变量 成员变量描述成员变量描述变量类型变量类型名称名称 Hashtable对象类型HashtableNULL 文本域 JTextField 学号 姓名 专业 年级 出生 组合框 JComboBoxSmajor 单选框 ButtonGroup 男 女 按钮多斥作用域 ButtonGroupgroup 按钮 JButton 开始修改 录入修改 重置 表 2 6 主要方法 方法名称方法名称返回类型返回类型功能功能备注备注 ModifySituation无类型创建修改学生信息界面构造方法 actionPerformed无类型处理响应事件继承自父类抽象方法 clearMess无类型清除文本框内容无 8 8 核心源代码核心源代码ModifySituationModifySituation java java publicpublic classclass ModifySituationModifySituation extendsextends JPanelJPanel implementsimplements ActionListenerActionListener HashtableHashtable 基本信息表基本信息表 null null JTextFieldJTextField 学号学号 姓名姓名 专业专业 年级年级 出生出生 JRadioButtonJRadioButton 男男 女女 ButtonGroupButtonGroup group null group null JButtonJButton 开始修改开始修改 录入修改录入修改 重置重置 FileInputStreamFileInputStream inOne null inOne null ObjectInputStreamObjectInputStream inTwo null inTwo null FileOutputStreamFileOutputStream outOne null outOne null ObjectOutputStreamObjectOutputStream outTwo null outTwo null FileFile file null file null publicpublic ModifySituation FileModifySituation File file file this file file this file file 学号学号 new new JTextField 10 JTextField 10 姓名姓名 new new JTextField 10 JTextField 10 专业专业 new new JTextField 10 JTextField 10 年级年级 new new JTextField 10 JTextField 10 出生出生 new new JTextField 10 JTextField 10 group newgroup new ButtonGroup ButtonGroup 男男 new new JRadioButton JRadioButton 男男 true true 女女 new new JRadioButton JRadioButton 女女 false false group add group add 男男 group add group add 女女 开始修改开始修改 new new JButton JButton 开始修改开始修改 录入修改录入修改 new new JButton JButton 录入修改录入修改 录入修改录入修改 setEnabled false setEnabled false 重置重置 new new JButton JButton 重置重置 学号学号 addActionListener this addActionListener this 开始修改开始修改 addActionListener this addActionListener this 录入修改录入修改 addActionListener this addActionListener this 重置重置 addActionListener this addActionListener this BoxBox box1 Box createHorizontalBox box1 Box createHorizontalBox 部分源代码省略部分源代码省略 学号学号 setText null setText null 姓名姓名 setText null setText null 专业专业 setText null setText null 年级年级 setText null setText null 出生出生 setText null setText null catch Exceptioncatch Exception ee ee System out println ee System out println ee 录入修改录入修改 setEnabled false setEnabled false elseelse if ok JOptionPane NO OPTION if ok JOptionPane NO OPTION 录入修改录入修改 setEnabled true setEnabled true elseelse StringString warning warning 该学号没有基本信息该学号没有基本信息 不能修改不能修改 录入修改录入修改 setEnabled false setEnabled false 9 9 elseelse StringString warning warning 必须要输入学号必须要输入学号 JoptionPane showmessageDialog this waring JoptionPane showmessageDialog this waring 警告警告 JoptionPane WARNINGJoptionPane WARNING 录入修改录入修改 setEnabled false setEnabled false if e getSource if e getSource 重置重置 学号学号 setText null setText null 姓名姓名 setText null setText null 专业专业 setText null setText null 年级年级 setText null setText null 出生出生 setText null setText null 2 4 类类 inquest 表 2 7 主要成员变量 成员变量描述成员变量描述变量类型变量类型名称名称 Hashtable对象类型Hashtable inquest 文本域 JTextField 学号 姓名 专业 年级 出生 启动并执行打印作业 PrintJobpri 单选框 ButtonGroup 男 女 按钮多斥作用域 ButtonGroupgroup 按钮 JButton 查询 表 2 8 主要方法 方法名称方法名称返回类型返回类型功能功能备注备注 inquest无类型创建录入学生信息界面构造方法 actionPerformed无类型处理响应事件继承自父类抽象方法 核心源代码核心源代码inquestinquest java java importimport java awt java awt importimport java awt event java awt event importimport javax swing javax swing importimport java io java io importimport java util java util publicpublic classclass InquestInquest extendsextends JDialogJDialog implementsimplements ActionListenerActionListener HashtableHashtable 基本信息表基本信息表 null null JTextFieldJTextField 学号学号 姓名姓名 专业专业 年级年级 出生出生 1010 JRadioButtonJRadioButton 男男 女女 JButtonJButton 查询查询 ButtonGroupButtonGroup group null group null FileInputStreamFileInputStream inOne null inOne null ObjectInputStreamObjectInputStream inTwo null inTwo null FileFile file null file null publicpublic Inquest JFrameInquest JFrame f Filef File file file 部分源代码省略部分源代码省略 inOne close inOne close inTwo close inTwo close catch Exceptioncatch Exception ee ee if if 基本信息表基本信息表 containsKey number containsKey number StudentStudent stu Student stu Student 基本信息表基本信息表 get number get number 姓名姓名 setText stu getName setText stu getName 专业专业 setText stu getDisciping setText stu getDisciping 年级年级 setText stu getGrade setText stu getGrade 出生出生 setText stu getBorth setText stu getBorth if stu getSex equals if stu getSex equals 男男 男男 setSelected true setSelected true elseelse 女女 setSelected true setSelected true elseelse StringString warning warning 该学号不存在该学号不存在 1111 2 5 类类 Delete 表 2 9 主要成员变量 成员变量描述成员变量描述变量类型变量类型名称名称 Hashtable 对象类型 HashtabledelStu queryStu 文本域 JTextField 学号 姓名 专业 年级 出生 单选框 ButtonGroup 男 女 按钮多斥作用域 ButtonGroupgroup 按钮 JButtondel 表 2 10 主要方法 方法名称方法名称 返回类返回类 型型 功能功能备注备注 InputStudent无类型创建录入学生信息界面构造方法 actionPerformed无类型处理响应事件继承自父类抽象方法 核心源代码核心源代码 DeleteDelete java java publicpublic classclass DeleteDelete extendsextends JPanelJPanel implementsimplements ActionListenerActionListener HashtableHashtable 基本信息表基本信息表 null null JTextFieldJTextField 学号学号 姓名姓名 专业专业 年级年级 出生出生 JRadioButtonJRadioButton 男男 女女 JButtonJButton 删除删除 ButtonGroupButtonGroup group null group null FileInputStreamFileInputStream inOne null inOne null ObjectInputStreamObjectInputStream inTwo null inTwo null FileOutputStreamFileOutputStream outOne null outOne null ObjectOutputStreamObjectOutputStream outTwo null outTwo null FileFile file null file null publicpublic Delete FileDelete File file file this file file this file file 学号学号 new new JTextField 10 JTextField 10 删除删除 new new JButton JButton 删除删除 学号学号 addActionListener this addActionListener this 删除删除 addActionListener this addActionListener this 姓名姓名 new new JTextField 10 JTextField 10 姓名姓名 setEditable false setEditable false 专业专业 new new JTextField 10 JTextField 10 专业专业 setEditable false setEditable false 年级年级 new new JTextField 10 JTextField 10 年级年级 setEditable false setEditable false 出生出生 new new JTextField 10 JTextField 10 出生出生 setEditable false setEditable false 男男 new new JRadioButton JRadioButton 男男 false false 女女 new new JRadioButton JRadioButton 女女 false false AGE AGE 部分源代码省略部分源代码省略 if ok JOptionPane YES OPTION if ok JOptionPane YES OPTION 1212 基本信息表基本信息表 remove number remove number trytry outOne newoutOne new FileOutputStream file FileOutputStream file outTwo newoutTwo new ObjectOutputStream outOne ObjectOutputStream outOne outTwo writeObject outTwo writeObject 基本信息表基本信息表 outTwo close outTwo close outOne close outOne close 学号学号 setText null setText null 姓名姓名 setText null setText null 专业专业 setText null setText null 年级年级 setText null setText null 出生出生 setText null setText null catch Exceptioncatch Exception ee ee System out println ee System out println ee elseelse if ok JOptionPane NO OPTION if ok JOptionPane NO OPTION 学号学号 setText null setText null 姓名姓名 setText null setText null 专业专业 setText null setText null 年级年级 setText null setText null 出生出生 setText null setText null elseelse StringString warning warning 该学号不存在该学号不存在 JOptionPane showMessageDialog this warning JOptionPane showMessageDialog this warning 警告警告 JOptionPane WARNING MESSAGE JOptionPane WARNING MESSAGE elseelse StringString warning warning 必须要输入学号必须要输入学号 JOptionPane showMessageDialog this warning JOptionPane showMessageDialog this warning 警告警告 JOptionPane WARNING MESSAGE JOptionPane WARNING MESSAGE 2 6 类类 Student 核心源代码核心源代码 StudentStudent java java pub

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论