Java程序设计18223_第1页
Java程序设计18223_第2页
Java程序设计18223_第3页
Java程序设计18223_第4页
Java程序设计18223_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

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

文档简介

1、Java程序设计课程设计报告题目:学生宿舍管理信息系统班级:计算机班姓名:谢梦媛 学号:12011247155目录一:程序设计的目的和意义二:程序设计:三:系统功能设计分析四:程序绘图效果示意图五:程序源代码及其分析说明六、总结七、个人心得体会学生宿舍信息管理系统的开发一、 程序设计的目的、任务和意义。1、 开发背景。在计算机越来越发达的今天,人们对计算机信息采集和保存的依赖越来越多,越来越离不开计算机,由此而产生的各种信息管理系统也越来越多,信息管理系统的发展日新月异,因此产生了各种能够很好的管理和保存信息,并且让人们使用方便的系统工具,所以我选择这个题目,因为可以通过制作该程序能更好的学习

2、编程知识,在以后的生活当中灵活应用。2、程序设计的任务。课程设计旨在在完成本课程的学习后,可以利用Java语言开发工具迅速地编写有一定实用价值的应用程序。课程设计中的问题比平时的习题复杂得多,也更接近实际。课程设计着眼于原理与应用的结合点,使学生学会如何把书上学到的知识用于解决实际问题,培养学生的动手能力;另一方面,使书上的知识变活,起到深化理解和灵活应用教学内容的目的。平时的习题局限于一个和二个知识点,而课程设计题是程序设计的综合训练,包括问题分析,总体结构设计,用户界面设计、程序设计、基本技能和技巧。本次课程设计要求学生能熟练运用eclipse和jdk工具包,掌握各种布局方式、异常处理、事

3、件监听与相应等基本知识点,实现对数据的添加、删除、修改、查询等基本功能的实现。最后能将自己的设计理念以及设计过程在文档中作出阐述与说明。3、 程序设计的意义我们可以看到如何运用自己已经掌握的知识,自己动手来完成一个Java绘图程序,通过整个流程的熟悉以及对程序组织结构和框架的理解,也可以极大的促进我们对Java程序程序设计的认识和掌握。通过本次课程的学习,我们可以更加系统地学习和了解如何从整体上设计和实现一个程序,这对我们今后学习、开发和设计更大更复杂的程序有着很大的帮助。二、 程序的设计1、 程序介绍本项目组设计的是学生宿舍信息管理系统,用户可以通过该系统对宿舍信息进行增、删、改、查。用户通

4、过登陆界面登陆进入宿舍信息管理系统,用户初次登陆密码与学号相同,进入后,用户可以选择添加成绩、删除信息、修改信息、查询信息。通过添加信息选项,用户可以录入自己的正确宿舍信息;通过删除信息;通过查询信息选项,用户可以选择查询某个学生的宿舍信息,也可以显示全部同学的信息。用户使用完毕后,点击退出,即可以退出该系统。所以通过这样的编程,让同学们可以的体验现在发展越来越好的信息化时代,不管从任何的方面。三:系统功能设计分析模块功能大概可以分为如下2个方面: 学生信息学生信息的输入,查询,删除。 成绩 根据学生的学号查询学生的宿舍信息。四:程序绘图效果示意图数据库添加信息删除信息修改信息查询信息用户登录

5、选择功能五:程序源代码及其分析说明5.1学生宿舍信息管理系统登录窗口import java.awt.Color;import java.awt.EventQueue;import java.awt.Font;import java.awt.SystemColor;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Arrays;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.J

6、Label;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JRadioButton;import javax.swing.JTextField;import javax.swing.border.EmptyBorder;import java.awt.Toolkit;import javax.swing.ImageIcon;public class SysFrame extends JFrame private JPanel contentPane; private JPanel p

7、anel; private JTextField txtProknight; private JPasswordField passwordField; private JButton btnNewButton; private static String 确定 = 确定; private static boolean isPasswordCorrect(char input) boolean isCorrect = true;char correctPassword = a, p, p, l, e ;if (input.length != correctPassword.length) is

8、Correct = false; else isCorrect = Arrays.equals(input, correctPassword);/ Zero out the password.Arrays.fill(correctPassword, 0);return isCorrect; /* * Launch the application. */ public static void main(String args) EventQueue.invokeLater(new Runnable() public void run() try SysFrame frame = new SysF

9、rame(); frame.setVisible(true); catch (Exception e) e.printStackTrace(); ); /* * Create the frame. */ public SysFrame() setFont(new Font(楷体, Font.BOLD, 18); setIconImage(Toolkit.getDefaultToolkit().getImage(F:u9AD8u59AEu7167u7247u684Cu976250e510829a2601.jpg);setTitle(u5B66u751Fu5BBFu820Du7BA1u7406u4

10、FE1u606Fu7CFBu7EDF);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 459, 309);setResizable(false);setLocationRelativeTo(null);contentPane = new JPanel();contentPane.setBorder(new EmptyBorder(5, 5, 5, 5);setContentPane(contentPane);contentPane.setLayout(null);panel = new JPanel();p

11、anel.setBounds(10, 10, 433, 261);contentPane.add(panel);panel.setLayout(null);JPanel panel_1 = new JPanel();panel_1.setBackground(SystemColor.activeCaption);panel_1.setBounds(94, 10, 274, 43);panel.add(panel_1);panel_1.setLayout(null);JLabel lblNewLabel = new JLabel(学生宿舍管理信息系统);lblNewLabel.setBounds

12、(10, 10, 402, 24);panel_1.add(lblNewLabel);lblNewLabel.setForeground(new Color(51, 51, 51);lblNewLabel.setFont(new Font(楷体, Font.BOLD, 24);JPanel panel_2 = new JPanel();panel_2.setBackground(SystemColor.activeCaption);panel_2.setBounds(39, 63, 366, 187);panel.add(panel_2);panel_2.setLayout(null);JLa

13、bel lblNewLabel_1 = new JLabel(用户名);lblNewLabel_1.setFont(new Font(楷体, Font.BOLD, 18);lblNewLabel_1.setBounds(66, 10, 70, 15);panel_2.add(lblNewLabel_1);JLabel lblNewLabel_2 = new JLabel(密码);lblNewLabel_2.setFont(new Font(楷体, Font.BOLD, 18);lblNewLabel_2.setBounds(66, 63, 82, 15);panel_2.add(lblNewL

14、abel_2);txtProknight = new JTextField();txtProknight.setBounds(66, 32, 154, 21);panel_2.add(txtProknight);txtProknight.setColumns(10);JRadioButton rdbtnNewRadioButton = new JRadioButton(学生);rdbtnNewRadioButton.setBackground(SystemColor.activeCaptionBorder);rdbtnNewRadioButton.setBounds(230, 31, 70,

15、23);panel_2.add(rdbtnNewRadioButton);JRadioButton rdbtnNewRadioButton_1 = new JRadioButton(老师);rdbtnNewRadioButton_1.setBackground(SystemColor.activeCaptionBorder);rdbtnNewRadioButton_1.setBounds(230, 87, 70, 23);panel_2.add(rdbtnNewRadioButton_1);btnNewButton = new JButton(确定);btnNewButton.setFont(

16、new Font(楷体, Font.BOLD, 18);btnNewButton.setActionCommand(确定);btnNewButton.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) /* * String cmd = e.getActionCommand(); * * if (Login.equals(cmd) / Process the password. char * input = passwordField.getPassword(); if * (isP

17、asswordCorrect(input) * JOptionPane.showMessageDialog(null, * Success! You typed the right password.); else * JOptionPane.showMessageDialog(null, * Invalid password. Try again., Error Message, * JOptionPane.ERROR_MESSAGE); * * / Zero out the possible password, for security. * Arrays.fill(input, 0);

18、* * passwordField.selectAll(); / handle the Help button. */new SecondFrame(); );btnNewButton.setBackground(SystemColor.activeCaptionBorder);btnNewButton.setBounds(78, 136, 82, 32);panel_2.add(btnNewButton);passwordField = new JPasswordField();passwordField.setColumns(10);passwordField.setBounds(66,

19、88, 153, 21);panel_2.add(passwordField); 5.2学生宿舍信息管理系统界面import java.awt.Color;import java.awt.EventQueue;import java.awt.Font;import java.awt.SystemColor;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.

20、File;import java.io.FileReader;import java.io.FileWriter;import javax.swing.JButton;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.border.EmptyBorder;import jav

21、a.awt.Toolkit;public class SecondFrame extends JFrame private JPanel contentPane; private JTextField textField; private JTextField textField_1; private JTextField textField_2; private JTextField textField_4; private JTextField textField_5; private JComboBox comboBox, comboBox_1; Integer integers = 1

22、, 2, 3, 4, 5, 6, 7, 8, 9,10,11 ; String gender = 男, 女 ; private JTextField textField_3; private JTextField textField_6; /* * Launch the application. */ public static void main(String args) EventQueue.invokeLater(new Runnable() public void run() try SecondFrame frame = new SecondFrame(); frame.setVis

23、ible(true); catch (Exception e) e.printStackTrace(); ); /* * Create the frame. */ public SecondFrame() setFont(new Font(楷体, Font.PLAIN, 18); setForeground(new Color(153, 102, 153); setIconImage(Toolkit.getDefaultToolkit().getImage(F:u9AD8u59AEu7167u7247u684Cu976250e510829a2601.jpg);setTitle(u5B66u75

24、1Fu5BBFu820Du4FE1u606Fu7BA1u7406u7CFBu7EDF);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 452, 442);setResizable(false);setLocationRelativeTo(null);setVisible(true);contentPane = new JPanel();contentPane.setBorder(new EmptyBorder(5, 5, 5, 5);setContentPane(contentPane);contentPa

25、ne.setLayout(null);JPanel panel = new JPanel();panel.setBackground(SystemColor.activeCaption);panel.setBounds(10, 10, 420, 338);contentPane.add(panel);panel.setLayout(null);JPanel panel_1 = new JPanel();panel_1.setBackground(new Color(255, 0, 0);panel_1.setBounds(10, 10, 394, 43);panel.add(panel_1);

26、panel_1.setLayout(null);JLabel lblNewLabel = new JLabel(u59D3 u540D);lblNewLabel.setFont(new Font(楷体, Font.BOLD, 18);lblNewLabel.setBounds(10, 10, 66, 23);panel_1.add(lblNewLabel);textField = new JTextField();textField.setBounds(74, 9, 66, 21);panel_1.add(textField);textField.setColumns(10);JLabel l

27、blNewLabel_6 = new JLabel(u6027u522B);lblNewLabel_6.setBounds(188, 12, 54, 15);panel_1.add(lblNewLabel_6);lblNewLabel_6.setFont(new Font(楷体, Font.BOLD, 18);final JComboBox comboBox_1_1 = new JComboBox(gender);comboBox_1_1.setBounds(236, 9, 59, 21);panel_1.add(comboBox_1_1);comboBox_1_1.setFont(new F

28、ont(宋体, Font.PLAIN, 12);comboBox_1_1.setSelectedIndex(0);JPanel panel_2 = new JPanel();panel_2.setBackground(new Color(255, 51, 0);panel_2.setBounds(10, 57, 394, 43);panel.add(panel_2);panel_2.setLayout(null);JLabel lblNewLabel_1 = new JLabel(u5B66 u53F7);lblNewLabel_1.setFont(new Font(楷体, Font.BOLD

29、, 18);lblNewLabel_1.setBounds(10, 10, 69, 20);panel_2.add(lblNewLabel_1);textField_1 = new JTextField();textField_1.setBounds(74, 9, 310, 21);panel_2.add(textField_1);textField_1.setColumns(10);JPanel panel_3 = new JPanel();panel_3.setBackground(new Color(255, 255, 0);panel_3.setBounds(10, 100, 394,

30、 43);panel.add(panel_3);panel_3.setLayout(null);textField_2 = new JTextField();textField_2.setBounds(74, 13, 310, 21);panel_3.add(textField_2);textField_2.setColumns(10);JLabel lblNewLabel_4 = new JLabel(u7CFB u522B);lblNewLabel_4.setBounds(10, 10, 72, 23);panel_3.add(lblNewLabel_4);lblNewLabel_4.se

31、tFont(new Font(楷体, Font.BOLD, 18);JPanel panel_4 = new JPanel();panel_4.setBackground(new Color(0, 255, 51);panel_4.setBounds(10, 145, 394, 43);panel.add(panel_4);panel_4.setLayout(null);JLabel lblNewLabel_8 = new JLabel(u4E13 u4E1A);lblNewLabel_8.setBounds(10, 10, 69, 21);panel_4.add(lblNewLabel_8)

32、;lblNewLabel_8.setFont(new Font(楷体, Font.BOLD, 18);textField_3 = new JTextField();textField_3.setBounds(74, 10, 69, 21);panel_4.add(textField_3);textField_3.setColumns(10);JPanel panel_5 = new JPanel();panel_5.setBackground(new Color(255, 51, 255);panel_5.setBounds(10, 280, 394, 43);panel.add(panel_

33、5);panel_5.setLayout(null);textField_4 = new JTextField();textField_4.setBounds(74, 7, 66, 21);panel_5.add(textField_4);textField_4.setColumns(10);JLabel lblNewLabel_7 = new JLabel(u5BBFu820Du53F7);lblNewLabel_7.setBounds(10, 10, 57, 23);panel_5.add(lblNewLabel_7);lblNewLabel_7.setFont(new Font(楷体,

34、Font.BOLD, 18);JLabel lblNewLabel_5 = new JLabel(u5206u6570);lblNewLabel_5.setFont(new Font(宋体, Font.PLAIN, 12);lblNewLabel_5.setBounds(10, 10, 54, 15);textField_5 = new JTextField();textField_5.setBounds(74, 7, 59, 21);textField_5.setColumns(10);JPanel panel_8 = new JPanel();panel_8.setBackground(n

35、ew Color(0, 51, 204);panel_8.setBounds(10, 190, 394, 43);panel.add(panel_8);panel_8.setLayout(null);JLabel lblNewLabel_3 = new JLabel(u5E74 u7EA7);lblNewLabel_3.setBounds(10, 10, 92, 23);panel_8.add(lblNewLabel_3);lblNewLabel_3.setFont(new Font(楷体, Font.BOLD, 18);textField_6 = new JTextField();textF

36、ield_6.setBounds(75, 11, 68, 21);panel_8.add(textField_6);textField_6.setFont(new Font(楷体, Font.BOLD, 18);textField_6.setColumns(10);JPanel panel_9 = new JPanel();panel_9.setBounds(10, 232, 394, 43);panel.add(panel_9);panel_9.setBackground(new Color(51, 204, 255);panel_9.setLayout(null);JLabel lblNe

37、wLabel_2 = new JLabel(u5BBFu820Du697C);lblNewLabel_2.setBounds(10, 4, 68, 29);panel_9.add(lblNewLabel_2);lblNewLabel_2.setFont(new Font(楷体, Font.BOLD, 18);final JComboBox comboBox_2 = new JComboBox(integers);comboBox_2.setBounds(74, 10, 68, 21);panel_9.add(comboBox_2);comboBox_2.setFont(new Font(宋体,

38、 Font.PLAIN, 12);comboBox_2.setSelectedIndex(0); JPanel panel_7 = new JPanel(); panel_7.setBackground(SystemColor.activeCaption);panel_7.setBounds(10, 358, 420, 50);contentPane.add(panel_7);panel_7.setLayout(null);JButton btnNewButton = new JButton(u4FDDu5B58);btnNewButton.addActionListener(new Acti

39、onListener() public void actionPerformed(ActionEvent e) JOptionPane.showMessageDialog(null, 文件已保存到C盘!);String s = new String();String s1 = new String();try File f = new File(D:Student.txt); if (f.exists() else f.createNewFile();/ 不存在则创建 BufferedReader input = new BufferedReader(new FileReader(f); wh

40、ile (s = input.readLine() != null) s1 += s + n; input.close(); s1 += 姓名: + textField.getText() + + 学号: + textField_1.getText() + + 性别: + comboBox_1_1.getSelectedItem() + + 宿舍楼: + comboBox_2.getSelectedItem() + 专业: + textField_6.getText() + + + textField_5.getText(); BufferedWriter output = new Buffe

41、redWriter( new FileWriter(f); output.write(s1); output.close(); catch (Exception exception) );btnNewButton.setFont(new Font(楷体, Font.BOLD, 18);btnNewButton.setBounds(151, 10, 93, 23);panel_7.add(btnNewButton);JButton btnNewButton_2 = new JButton(u65B0u5EFA);btnNewButton_2.setBounds(10, 10, 93, 23);panel_7.add(btnNewButton_2);btnNewButton_2.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) textField.setText();textField_1.setText();textField_2.setText();textField_3.setText();textField

温馨提示

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

评论

0/150

提交评论