《java程序设计方案》学生管理系统报告说明书_第1页
《java程序设计方案》学生管理系统报告说明书_第2页
《java程序设计方案》学生管理系统报告说明书_第3页
《java程序设计方案》学生管理系统报告说明书_第4页
《java程序设计方案》学生管理系统报告说明书_第5页
已阅读5页,还剩17页未读 继续免费阅读

付费下载

下载本文档

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

文档简介

PAGEII《Java程序设计》结课报告课程名称JAVA程序设计设计题目同学信息管理系统专业班级信科101班学号09同学姓名XX教师彭洁信息工程系《Java程序设计》结课报告ﻩ目录TOC\o"1-2"\h\uHYPERLINK\l"_Toc355627604"目录ﻩPAGEREF_Toc355627604\hIIHYPERLINK\l”_Toc355627605"第1章系统简介 PAGEREF_Toc355627605\h3HYPERLINK\l"_Toc355627606”1.1系统功能 PAGEREF_Toc355627606\h3HYPERLINK\l"_Toc355627607”1.2系统引用例子ﻩPAGEREF_Toc355627607\h3HYPERLINK\l”_Toc355627608”第2章表的设计ﻩPAGEREF_Toc355627608\h4HYPERLINK\l"_Toc355627609"2.1系统数据库表结构ﻩPAGEREF_Toc355627609\h4HYPERLINK\l"_Toc355627610"第3章连接数据库的实现ﻩPAGEREF_Toc355627610\h5HYPERLINK\l”_Toc355627611"3.1SQLServer数据库连接的关键代码ﻩPAGEREF_Toc355627611\h5HYPERLINK\l"_Toc355627612"第4章系统简略设计ﻩPAGEREF_Toc355627612\h6HYPERLINK\l"_Toc355627613"4。1 系统登录模块设计ﻩPAGEREF_Toc355627613\h6HYPERLINK\l”_Toc355627614"4。2系统主界面简略设计 PAGEREF_Toc355627614\h9HYPERLINK4。3同学信息增删改模块设计ﻩPAGEREF_Toc355627615\h10_Toc355627617”4.5注册子管理员模块设计ﻩPAGEREF_Toc355627617\h15HYPERLINK第4章系统简略设计 HYPERLINK\l"_Toc293570566”4。1 系统登录模块设计4。1.1、运行效果图图4.1登录主界面效果图4.1.2、主要代码publicclassloginextendsJDialog{staticPreparedStatementSQL; privatestaticfinallongserialVersionUID=1L;privateJLabell_Id=newJLabel(”登陆账户”,JLabel.CENTER);privateJLabell_pw=newJLabel("登陆密码",JLabel。CENTER);privateJTextFieldt_Id=newJTextField(10);privateJPasswordFieldt_pw=newJPasswordField(10);privateJButtonbtnLogin;privateJButtonbtnAdd;privateJButtonbtnClose;intnum=3;publiclogin(){super();DimensionscreenSize=Toolkit.getDefaultToolkit()。getScreenSize();this.setLocation((screenSize.width-300)/2,(screenSize.height-200)/2);this。setResizable(false);getContentPane().setBackground(newColor(225,225,225));getContentPane()。setLayout(null);initialize();}protectedvoidinitialize(){ setTitle("系统登录”);ﻩl_Id。setBounds(48,43,53,25); t_Id.setBounds(110,43,150,25); l_pw.setBounds(48,93,53,25);ﻩt_pw。setBounds(110,93,150,25);ﻩgetContentPane().add(l_Id);ﻩgetContentPane()。add(l_pw);getContentPane().add(t_Id);getContentPane()。add(t_pw);btnLogin=newJButton();btnLogin。setText("登录”);btnLogin.setBounds(20,142,85,28);btnLogin.setBackground(newColor(244,243,239)); ﻩbtnLogin。addActionListener(newActionListener(){ publicvoidactionPerformed(ActionEvente){ﻩ ﻩ ﻩﻩﻩaddBtnLoginActionListener(); } }); getContentPane()。add(btnLogin);btnAdd=newJButton();btnAdd.setText("注册”);btnAdd。setBounds(105,142,85,28);btnAdd。addActionListener(newActionListener(){ﻩﻩpublicvoidactionPerformed(ActionEvente){ﻩﻩaddNewzc=newaddNew();ﻩ setVisible(false);ﻩ zc.setVisible(true); }});getContentPane()。add(btnAdd);btnClose=newJButton();btnClose。setText(”关闭”);btnClose。setBounds(190,142,85,28);btnClose.addActionListener(newActionListener(){ ﻩpublicvoidactionPerformed(ActionEvente){ ﻩﻩdispose(); ﻩﻩSystem.exit(-1); }});getContentPane()。add(btnClose);}privatevoidaddBtnLoginActionListener(){Stringid=t_Id.getText();Stringpassword=newString(t_pw.getPassword());if(id。equals(””)){ JOptionPane。showMessageDialog(this,"帐号不行为空","提示",ﻩJOptionPane.WARNING_MESSAGE); return;}elseif(password.equals(”")){ﻩJOptionPane.showMessageDialog(this,"密码不行为空",”提示",ﻩJOptionPane。WARNING_MESSAGE); return;}else{ toolst=newtools();ﻩbooleansuccess=false;//TODO:数据校验ﻩﻩsuccess=t.eqes(id,password); if(success){//如果数据校验成功显示主界面ﻩﻩ JOptionPane.showMessageDialog(this,"成功登录”,”提示", ﻩJOptionPane.INFORMATION_MESSAGE); ﻩnewmainView(); this.dispose();ﻩ }else{ﻩﻩﻩ--num; ﻩif(num==0){ﻩﻩﻩ JOptionPane。showMessageDialog(this,”用户名或者密码错误!您没有机会了");ﻩ ﻩ System。exit(0);ﻩ }else{ﻩ ﻩJOptionPane.showMessageDialog(this,"用户名或者密码错误!您还有”+num+"次机会"); ﻩ} ﻩ}ﻩ}}publicDimensiongetPreferredSize(){returnnewDimension(320,170);}publicvoidshow(){Toolkittk=Toolkit。getDefaultToolkit();Dimensionscreen=tk.getScreenSize();Dimensiond=getSize();this.setLocation((screen.width—d.width)/2,(screen.height-d.height)/2); //输入密码后回车相当于点击了登录按钮 getRootPane().setDefaultButton(btnLogin);t_pw.requestFocus();setDefaultCloseOperation(DISPOSE_ON_CLOSE);ﻩsetSize(300,220); super.show();} publicstaticvoidmain(String[]args){DButilutil=newDButil();ﻩutil。getconn();ﻩloginloginFrame=newlogin();loginFrame。setVisible(true);}}HYPERLINK\l"_Toc293570567"4。2 系统主界面简略设计 4。2。1、运行效果图图4.2登录后系统界面效果图4。2.2、主要代码publicmainView(){ super();ﻩﻩsetTitle("全部同学信息");ﻩ setBounds(350,150,700,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);ﻩ setVisible(true); finalJScrollPanescrollPane=newJScrollPane(); con=db.getconn(); ﻩVectortableValueV,columnNameV;//存放列名ﻩ columnNameV=newVector();ﻩﻩcolumnNameV.add(”学号"); columnNameV.add("名字");ﻩﻩcolumnNameV。add(”性别");ﻩﻩcolumnNameV.add("年龄"); ﻩtableValueV=newVector();scrollPane.setViewportView(table);ﻩ finalJPanelpanel=newJPanel(); getContentPane().add(panel,BorderLayout.SOUTH);ﻩﻩpanel。add(newJLabel(”编号:"));ﻩ aTextField=newJTextField(”",5);ﻩﻩpanel。add(aTextField); ﻩpanel.add(newJLabel(”姓名:")); ﻩbTextField=newJTextField("",5); ﻩpanel。add(bTextField); ﻩpanel。add(newJLabel(”性别:"));ﻩ cTextField=newJTextField("",5);ﻩ panel.add(cTextField); ﻩpanel。add(newJLabel("年龄:"));ﻩ dTextField=newJTextField(””,5);ﻩpanel.add(dTextField);}HYPERLINK\l"_Toc293570568"4.3ﻩ同学信息增删改模块设计 4。3。1、增加信息(121,白娘子,M,22)后运行效果图如下:图4.3增加一个记录效果图4。3.2、主要代码finalJButtonaddButton=newJButton(”添加");addButton.addActionListener(newActionListener(){ publicvoidactionPerformed(ActionEvente){ userDaoadd=newuserDaoImpl(); useru=newuser();ﻩ u。setSno(Integer.parseInt(aTextField.getText())); u.setsName(bTextField.getText());ﻩﻩu.setSsex(cTextField.getText()); u。setSage(Integer.parseInt(dTextField.getText()));ﻩ add.addUser(u);ﻩﻩsetVisible(false); ﻩnewmainView();ﻩ}});panel.add(addButton);4.3.3、删除信息编号为120的同学信息后结果如下:图4.4删除一个记录效果图4.3.4、主要代码:ﻩfinalJButtondelButton=newJButton("删除”); delButton.addActionListener(newActionListener(){ﻩﻩpublicvoidactionPerformed(ActionEvente){ﻩ userDaodel=newuserDaoImpl();ﻩ ﻩuserud=newuser();ﻩ ﻩintselectedRow=table。getSelectedRow();//获得被选中行的索引ﻩ if(selectedRow!=—1)//推断是否存在被选中行ﻩ del.deleUser(Integer.parseInt(aTextField。getText()));ﻩﻩﻩ setVisible(false);ﻩﻩ tableModel.removeRow(selectedRow);ﻩ ﻩ} });ﻩpanel。add(delButton);4。3.5、修改信息(105,关美眉,F,41)为(105,关大侠,M,30)后运行效果图如下:图4.5修改一个记录效果图4.3。6、主要代码:panel。add(searchButton);finalJButtonupdButton=newJButton("修改");updButton.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){userDaoupdate=newuserDaoImpl(); ﻩuserupe=newuser(); ﻩaTextField.setEditable(false); intselectedRow=table.getSelectedRow();//获得被选中行的索引 if(selectedRow!=-1){//推断是否存在被选中行ﻩﻩﻩupe。setSno(Integer。parseInt(aTextField。getText()));ﻩ upe.setsName(bTextField.getText());ﻩ ﻩupe。setSsex(cTextField。getText());ﻩ upe。setSage(Integer.parseInt(dTextField.getText())); ﻩupdate.updateUser(upe); ﻩﻩsetVisible(false); ﻩnewmainView();ﻩ } }});panel。add(updButton);HYPERLINK\l”_Toc293570569"4.4同学信息查询模块设计ﻩ4.4.1、运行效果图图4。6查询记录集效果图查询姓赵的人信息:图4。7查询结果图查询名字带“山”的人信息:图4。8查询结果图4.4。2、主要代码:publicsearch(){ﻩsetTitle(”依据姓名查询同学信息”); setLayout(newBorderLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); validate();ﻩsetBounds(350,150,650,400);ﻩfinalJPanelpane=newJPanel(); jl=newJLabel("输入姓或者名查询");ﻩTextField=newJTextField("",5);ﻩjb1=newJButton("查询");ﻩjb2=newJButton(”返回"); pane。add(jl); pane.add(TextField); pane.add(jb1); pane.add(jb2); getContentPane().add(pane,BorderLayout.NORTH); jb1.addActionListener(this);ﻩjb2.addActionListener(this); setVisible(true);}publicvoidactionPerformed(ActionEvente){ﻩif(e.getActionCommand().equals(”查询”)){ﻩﻩJScrollPanejsp=newJScrollPane(); ﻩVectortableValueV,columnNameV;ﻩﻩcolumnNameV=newVector(); ﻩcolumnNameV。add(”学号");ﻩﻩcolumnNameV.add(”名字"); ﻩcolumnNameV。add(”性别");ﻩ columnNameV.add("年龄"); ﻩtableValueV=newVector(); userDaouser=newuserDaoImpl();ﻩﻩuseru=user.searchByName(TextField.getText());ﻩ VectorrowV=newVector();ﻩﻩrowV.add(u.getSno()); rowV.add(u。getsName());ﻩﻩrowV。add(u。getSsex());ﻩ rowV。add(u.getSage()); ﻩtableValueV.add(rowV); ﻩtableModel=newDefaultTableModel(tableValueV,columnNameV);ﻩﻩtable=newJTable(tableModel);ﻩﻩjsp=newJScrollPane(table);ﻩ jsp.setViewportView(table); ﻩgetContentPane()。add(jsp,BorderLayout.CENTER);ﻩﻩsetVisible(true); }ﻩif(e.getActionCommand().equals("返回")){ﻩﻩnewmainView(); }}HYPERLINK\l”_Toc293570569”4.5注册子管理员模块设计ﻩ4.5。1、运行效果图图4。9注册子管理员效果图4.5.2、主要代码:publicaddNew(){ setDefaultCloseOperation(EXIT_ON_CLOSE);ﻩ load();ﻩ this.setVisible(true); ﻩDimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();ﻩ this.setLocation((screenSize。width-300)/2, ﻩ (screenSize。height-200)/2);ﻩﻩthis.setResizable(false); ﻩthis.setTitle("注册子管理员界面”);ﻩﻩthis.setVisible(true);ﻩ this.addWindowListener(newWindowAdapter(){ ﻩﻩpublicvoidwindowClosing(WindowEvente){ﻩ ﻩ System。exit(0); }ﻩﻩ});ﻩ} publicvoidload(){ﻩﻩPane=(JPanel)getContentPane(); Pane.setLayout(null);ﻩﻩsetSize(newDimension(410,300));ﻩ setTitle(”管理员登入界面”); t1。setBounds(70,50,100,30); ﻩt2.setBounds(70,80,100,30);ﻩ t3。setBounds(70,110,100,30); t4.setBounds(250,50,100,30);ﻩ t5。setBounds(250,80,100,30);ﻩﻩf1.setBounds(150,50,100,20);ﻩ f2。setBounds(150,80,100,20); ﻩf3。setBounds(150,110,100,20); b1。setFont(newjava.awt.Font(”Botton”,Font.BOLD,12)); ﻩb1。setBounds(120,140,60,50);ﻩﻩb2.setFont(newjava。awt。Font(”Dialog",Font.BOLD,12)); b2.setBounds(200,140,60,50);ﻩ Pane。add(t1);ﻩﻩPane.add(t2); ﻩPane.add(t3); ﻩPane.add(t4);ﻩ Pane。add(t5); Pane.add(f1); ﻩPane.add(f2); Pane。add(f3); ﻩPane。add(b1);ﻩﻩPane.add(b2); ﻩb1。addActionListener(this); b2.addActionListener(this); }4。5。3、当注册名已经存在时效果如下:图4.10验证注册界面4。5.4、成功注册时效果如下:(用户名:qunqun;密码:qunqun)图4.11注册成功界面4.5.5、主要代码publicvoidactionPerformed(ActionEvente){ ﻩif(e.getActionCommand().equals("注册”)){ﻩﻩﻩif(tools.indes(f1.getText())&&tools.indes(f2.getText())){ ﻩﻩif(tools.eqes(f1。getText(),f2.getText())){ ﻩ JOptionPane.showMessageDialog(this,"该用户已被注册,请重新输入!"); ﻩ ﻩ System.exit(0); ﻩ }else{ ﻩﻩ ﻩtools。addUser(f1.getText(),f1。getText()); ﻩﻩ JOptionPane.showMessageDialog(this,”你已经成功注册~");ﻩﻩﻩﻩ System。exit(0);ﻩ }ﻩﻩ } ﻩﻩif(f1.getText()。equals("")||f2。getText()。equals(””)){ ﻩ JOptionPane。showMessageDialog(this,"帐号或密码长度有误”,"提示",ﻩﻩ ﻩ JOptionPane.WARNING_MESSAGE); ﻩﻩ} ﻩ}ﻩﻩif(e。getActionCommand().equals(”退出”)){ ﻩﻩSystem.exit(0); ﻩ}4.5.6、新注册管理员(用户名:qunqun;密码:qunqun)登入效果如下:图4.12登录界面图4。13登录成功界面4.5.7、主要代码:staticbooleaneqes(Stringadmin,Stringpasswd){ booleanbool=true;ﻩtry{ InputStreamis=newFileInputStream("1111。txt");ﻩﻩBufferedReaderreader=newBufferedReader(newInputStreamReader(is));ﻩ String

温馨提示

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

评论

0/150

提交评论