java编写的简单的学生信息管理系统(源码、需求分析)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

学生信息管理系统一、需求分析1、可行性分析知识爆炸的时代里,求学的人数越来越多,但学校的数量及学校所能提供的资源很有限。为优化管理学生的人力资源,设计了这个系统。2、任务概述1)目标在计算机网络,数据库和先进的开发平台上,利用现有的软件、硬件资源,开发一个具有开放体系结构的,易扩充的,易维护的,具有良好人机交互界面的学生信息管理系统。2)需求要求这个简单的学生信息管理系统包括以下两个基本功能:·管理员登陆·学生信息管理二、层次图三、界面预览登录界面学生信息管理系统管理员登陆学生信息管理增加学生信息查询学生信息修改学生信息删除学生信息显示学生信息该管理员不存在学生信息管理界面填写学生信息录入学生信息按学号进行查询查询后可以进行信息的修改学生信息的删除显示全部学生信息四、系统说明1该系统并未使用数据库,只是把信息存放在了一个新建立的文本文档中2关于管理员信息,必须现在C盘建立一个名为Login的文本文档,在Login中存入用户名和密码且必须分行写入3若要修改学生信息必须先进行信息的查询,查询后方可进行信息修改五、源代码登录界面源代码importjava.awt.event.*;importjavax.swing.*;importjava.awt.*;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.WindowAdapter;importjava.awt.event.WindowEvent;importjava.io.BufferedReader;importjava.io.File;importjava.io.FileReader;importjava.io.IOException;importjava.util.*;importjava.sql.*;classLoginextendsJFrameimplementsActionListener{Containercp=null;Stringname=null;Stringpsw=null;JFramef=null;JButtonj1,j2;JTextFieldt1;JPasswordFieldt2;JLabeljlable1,jlable2;Colorc;JPaneljp1,jp2;Login(){f=newJFrame(学生管理系统);j1=newJButton(确定);j2=newJButton(取消);cp=f.getContentPane();jlable1=newJLabel(输入用户名);jlable2=newJLabel(用户密码);jp1=newJPanel();jp2=newJPanel();t1=newJTextField(18);t2=newJPasswordField(18);jp1.add(jlable1);jp1.add(t1);jp1.add(jlable2);jp1.add(t2);JLabelJL=newJLabel(htmlfontcolor=#000000size='6'i欢迎进入学生管理系统/i/font,SwingConstants.CENTER);cp.add(JL,North);jp2.add(j1);jp2.add(j2);cp.add(jp1,Center);cp.add(South,jp2);jp1.setBackground(Color.lightGray);Toolkitkit=Toolkit.getDefaultToolkit();Dimensionscreen=kit.getScreenSize();intx=screen.width;/*取得显示器窗口的宽度*/inty=screen.height;/*取得显示器窗口的高度*///setSize(x,y);/*让系统窗口平铺整个显示器窗口*/f.setSize(300,300);intxcenter=(x-300)/2;intycenter=(y-300)/2;f.setLocation(xcenter,ycenter);/*显示在窗口中央*/f.setVisible(true);//-----------------------------------------------------j1.addActionListener(this);//注册事件监听器j2.addActionListener(this);f.addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit(0);}});}publicvoidconfirm()throwsIOException//验证用户和密码是否存在{Filefile=newFile(C://Login.txt);try{if(!file.exists())file.createNewFile();}catch(IOExceptione){e.printStackTrace();}BufferedReaderbr=newBufferedReader(newFileReader(file));Stringtemp=br.readLine();Stringline;while((line=br.readLine())!=null){temp+=,+line;}if(temp==null){System.out.println();}else{///分割字符串String[]str=temp.split(,);name=str[0];psw=str[1];if(t1.getText().trim().equals(name)&&t2.getText().trim().equals(psw)){newTest();f.hide();br.close();}else{JOptionPane.showMessageDialog(null,该用户不存在,提示!,JOptionPane.YES_NO_OPTION);}t1.setText();t2.setText();//for(inti=0;istr.length;i++){//System.out.println(str[i]);//}}}publicvoidactionPerformed(ActionEvente){Stringcmd=e.getActionCommand();if(cmd.equals(确定)){try{confirm();}catch(IOExceptione1){//TODOAuto-generatedcatchblocke1.printStackTrace();}}elseif(cmd.equals(取消)){f.dispose();}}publicstaticvoidmain(String[]arg){Logina=newLogin();}}学生信息管理界面源代码importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.io.*;importjava.util.*;classStudentimplementsjava.io.Serializable{Stringnumber,name,specialty,grade,borth,sex;publicStudent(){};publicvoidsetNumber(Stringnumber){this.number=number;}publicStringgetNumber(){returnnumber;}publicvoidsetName(Stringname){this.name=name;}publicStringgetName(){returnname;}publicvoidsetSex(Stringsex){this.sex=sex;}publicStringgetSex(){returnsex;}publicvoidsetSpecialty(Stringspecialty){this.specialty=specialty;}publicStringgetSpecialty(){returnspecialty;}publicvoidsetGrade(Stringgrade){this.grade=grade;}publicStringgetGrade(){returngrade;}publicvoidsetBorth(Stringborth){this.borth=borth;}publicStringgetBorth(){returnborth;}}publicclassTestextendsJFrame{JLabellb=newJLabel(录入请先输入记录,查询、删除请先输入学号,修改是对查询+内容改后的保存!);JTextField学号,姓名,专业,年级,出生;JRadioButton男,女;ButtonGroupgroup=null;JButton录入,查询,删除,修改,显示;JPanelp1,p2,p3,p4,p5,p6,pv,ph;Student学生=null;Hashtable学生散列表=null;Filefile=null;FileInputStreaminOne=null;ObjectInputStreaminTwo=null;FileOutputStreamoutOne=null;ObjectOutputStreamoutTwo=null;publicTest(){super(学生信息管理系统);学号=newJTextField(10);姓名=newJTextField(10);专业=newJTextField(10);年级=newJTextField(10);出生=newJTextField(10);group=newButtonGroup();男=newJRadioButton(男,true);女=newJRadioButton(女,false);group.add(男);group.add(女);录入=newJButton(录入);查询=newJButton(查询);删除=newJButton(删除);修改=newJButton(修改);显示=newJButton(显示);录入.addActionListener(newInputAct());查询.addActionListener(newInquestAct());修改.addActionListener(newModifyAct());删除.addActionListener(newDeleteAct());显示.addActionListener(newShowAct());修改.setEnabled(false);p1=newJPanel();p1.add(newJLabel(学号:,JLabel.CENTER));p1.add(学号);p2=newJPanel();p2.add(newJLabel(姓名:,JLabel.CENTER));p2.add(姓名);p3=newJPanel();p3.add(newJLabel(性别:,JLabel.CENTER));p3.add(男);p3.add(女);p4=newJPanel();p4.add(newJLabel(专业:,JLabel.CENTER));p4.add(专业);p5=newJPanel();p5.add(newJLabel(年级:,JLabel.CENTER));p5.add(年级);p6=newJPanel();p6.add(newJLabel(出生:,JLabel.CENTER));p6.add(出生);pv=newJPanel();pv.setLayout(newGridLayout(6,

1 / 31
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功