Java程序设计18223

上传人:痛*** 文档编号:68573067 上传时间:2022-04-03 格式:DOC 页数:19 大小:150.50KB
收藏 版权申诉 举报 下载
Java程序设计18223_第1页
第1页 / 共19页
Java程序设计18223_第2页
第2页 / 共19页
Java程序设计18223_第3页
第3页 / 共19页
资源描述:

《Java程序设计18223》由会员分享,可在线阅读,更多相关《Java程序设计18223(19页珍藏版)》请在装配图网上搜索。

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);p

42、anel_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_4.setText();textField_5.setText();textField_6.setText();comboBox_2.setSelectedIn

43、dex(0);comboBox_1_1.setSelectedIndex(0); );btnNewButton_2.setFont(new Font(楷体, Font.BOLD, 18);JButton btnNewButton_1 = new JButton(u9000u51FA);btnNewButton_1.setBounds(304, 10, 93, 23);panel_7.add(btnNewButton_1);btnNewButton_1.setForeground(new Color(0, 0, 0);btnNewButton_1.addActionListener(new Ac

44、tionListener() public void actionPerformed(ActionEvent e) System.exit(1); );btnNewButton_1.setFont(new Font(楷体, Font.BOLD, 18); 六、总结 通过短暂两天半的课程设计,让我获益匪浅,不仅更深入的了解Java这门学科,更使自己有了继续探索的兴趣。虽然制作的学生成绩管理系统在功能上基本能够满足要求,但是也有很多不足的地方。通过对程序的不断调试与完善,所有功能均可实现,所设计系统已基本达到了设计要求,实现了主要的用户登录功能,实现了对信息管理的增、删、改、查等基本功能,基本达到

45、了预期设想。七、个人心得体会在本次课程设计中,通过一定的详细计划,展开课程设计,首先我参照书上与之相关的例子,对相关代码有了完整的认识后,自己编写这几个部分的程序,然后分别在eclipse中试运行,初步纠错并实现。大体的框架是编写课程设计代码的第一步,它关系到下面对学生信息的增、删、改、查等基本功能的实现,尤为重要。学生信息管理系统必然包括学生类和管理类这两个基本公共类,它们又都包括各自基本信息的输入与查询这两个部分。在这个过程中,我遇到的问题是如何将自己设计的程序中的错误改正并且能够很好的运行,为此我特别复习了一下课本的相关知识,在自己的一步步修改下终于得以解决。在定义输入和查询模块时,我将

46、重点放在了图形界面的设计上,虽然实现了输入和查询的基本功能,但由于自己的能力所限,界面设计得并不美观,没有达到我所预想的效果,但是觉得对于我现在的水平来说,我已经很满足了,并且很开心可以通过自己的双手设计出这样可以运行的界面。 本次java课程设计虽然短暂而紧张,但我过得很充实,收获不少。首先真正认识了JAVA程序设计实用教程对一些功能实现的简单性,这里就包括一些界面的结构的创建,觉得只要基本框架能想出来,将它展示并不困难。然后就是更多的学习到了java语言里的方法及java应用程序。在程序设计的过程中,我深感“认真严谨”这个词的重要性,一点点小的马虎,便会导致整个程序不能正常运行。在今后的学习中,我定将“认真严谨”时刻作为自的谨言。与此同时,在不会的问题上,身边的同学热情的帮我解决,让我觉得很温暖,大家互帮互助,一起在通往java的道路上共同向前一步,总之,此次课程设计在我的学生生涯中启上了至关重要的作用。

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!