Java程序設計18223_第1頁
Java程序設計18223_第2頁
Java程序設計18223_第3頁
Java程序設計18223_第4頁
Java程序設計18223_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Java程序設計課程設計報告題目:學生宿舍管理信息系統(tǒng)班級:計算機班姓名:謝夢媛 學號:12011247155目錄一:程序設計的目的和意義二:程序設計:三:系統(tǒng)功能設計分析四:程序繪圖效果示意圖五:程序源代碼及其分析說明六、總結七、個人心得體會學生宿舍信息管理系統(tǒng)的開發(fā)一、 程序設計的目的、任務和意義。1、 開發(fā)背景。在計算機越來越發(fā)達的今天,人們對計算機信息采集和保存的依賴越來越多,越來越離不開計算機,由此而產生的各種信息管理系統(tǒng)也越來越多,信息管理系統(tǒng)的發(fā)展日新月異,因此產生了各種能夠很好的管理和保存信息,并且讓人們使用方便的系統(tǒng)工具,所以我選擇這個題目,因為可以通過制作該程序能更好的學習

2、編程知識,在以后的生活當中靈活應用。2、程序設計的任務。課程設計旨在在完成本課程的學習后,可以利用Java語言開發(fā)工具迅速地編寫有一定實用價值的應用程序。課程設計中的問題比平時的習題復雜得多,也更接近實際。課程設計著眼于原理與應用的結合點,使學生學會如何把書上學到的知識用于解決實際問題,培養(yǎng)學生的動手能力;另一方面,使書上的知識變活,起到深化理解和靈活應用教學內容的目的。平時的習題局限于一個和二個知識點,而課程設計題是程序設計的綜合訓練,包括問題分析,總體結構設計,用戶界面設計、程序設計、基本技能和技巧。本次課程設計要求學生能熟練運用eclipse和jdk工具包,掌握各種布局方式、異常處理、事

3、件監(jiān)聽與相應等基本知識點,實現對數據的添加、刪除、修改、查詢等基本功能的實現。最后能將自己的設計理念以及設計過程在文檔中作出闡述與說明。3、 程序設計的意義我們可以看到如何運用自己已經掌握的知識,自己動手來完成一個Java繪圖程序,通過整個流程的熟悉以及對程序組織結構和框架的理解,也可以極大的促進我們對Java程序程序設計的認識和掌握。通過本次課程的學習,我們可以更加系統(tǒng)地學習和了解如何從整體上設計和實現一個程序,這對我們今后學習、開發(fā)和設計更大更復雜的程序有著很大的幫助。二、 程序的設計1、 程序介紹本項目組設計的是學生宿舍信息管理系統(tǒng),用戶可以通過該系統(tǒng)對宿舍信息進行增、刪、改、查。用戶通

4、過登陸界面登陸進入宿舍信息管理系統(tǒng),用戶初次登陸密碼與學號相同,進入后,用戶可以選擇添加成績、刪除信息、修改信息、查詢信息。通過添加信息選項,用戶可以錄入自己的正確宿舍信息;通過刪除信息;通過查詢信息選項,用戶可以選擇查詢某個學生的宿舍信息,也可以顯示全部同學的信息。用戶使用完畢后,點擊退出,即可以退出該系統(tǒng)。所以通過這樣的編程,讓同學們可以的體驗現在發(fā)展越來越好的信息化時代,不管從任何的方面。三:系統(tǒng)功能設計分析模塊功能大概可以分為如下2個方面: 學生信息學生信息的輸入,查詢,刪除。 成績 根據學生的學號查詢學生的宿舍信息。四:程序繪圖效果示意圖數據庫添加信息刪除信息修改信息查詢信息用戶登錄

5、選擇功能五:程序源代碼及其分析說明5.1學生宿舍信息管理系統(tǒng)登錄窗口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(學生宿舍管理信息系統(tǒng));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學生宿舍信息管理系統(tǒng)界面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();/ 不存在則創(chuàng)建 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() + 專業(yè): + 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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論