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

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、Java程序設(shè)計(jì)課程設(shè)計(jì)報(bào)告題目:學(xué)生宿舍管理信息系統(tǒng)班級(jí):計(jì)算機(jī)班姓名:謝夢(mèng)媛 學(xué)號(hào):12011247155目錄一:程序設(shè)計(jì)的目的和意義二:程序設(shè)計(jì):三:系統(tǒng)功能設(shè)計(jì)分析四:程序繪圖效果示意圖五:程序源代碼及其分析說(shuō)明六、總結(jié)七、個(gè)人心得體會(huì)學(xué)生宿舍信息管理系統(tǒng)的開(kāi)發(fā)一、 程序設(shè)計(jì)的目的、任務(wù)和意義。1、 開(kāi)發(fā)背景。在計(jì)算機(jī)越來(lái)越發(fā)達(dá)的今天,人們對(duì)計(jì)算機(jī)信息采集和保存的依賴越來(lái)越多,越來(lái)越離不開(kāi)計(jì)算機(jī),由此而產(chǎn)生的各種信息管理系統(tǒng)也越來(lái)越多,信息管理系統(tǒng)的發(fā)展日新月異,因此產(chǎn)生了各種能夠很好的管理和保存信息,并且讓人們使用方便的系統(tǒng)工具,所以我選擇這個(gè)題目,因?yàn)榭梢酝ㄟ^(guò)制作該程序能更好的學(xué)習(xí)

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

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

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

5、選擇功能五:程序源代碼及其分析說(shuō)明5.1學(xué)生宿舍信息管理系統(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(學(xué)生宿舍管理信息系統(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(學(xué)生);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學(xué)生宿舍信息管理系統(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() + + 學(xué)號(hào): + 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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論