Student Information Management System-----Documentation

Source: Internet
Author: User
Tags repetition uppercase letter

1. Design mode of the system
The basic information management system of this student is designed and developed according to MVC design pattern.
The System package has Controller,model,uitil,view, and the sub-package Dao,vo under model. where
The controller stores all event-handling listener classes.
DAO holds all operation classes, such as user actions (Userdao), Student information (Studentinformationdao)

Util stores all of the functional classes, such as the JDBC Package (Dbmanaer), and the data format check (Validate).

View stores all user interfaces, such as the login Interface (LoginView), the main interface (MainView).
VO stores all entity classes, such as user, student information (studentinformation).

2. Design process
2014-12-22
First, the design of the login function

1) Design of login graphic interface
Login graphical interface using BorderLayout layout, divided into top,center,bottom three parts.
The top area defines only one object of the JLabel class and displays the word "User logon".
The center area uses jtextfiled,jpasswordfiled, as well as JLabel, to display text boxes, password boxes, and their respective labels.
Bottom region with the JButton implementation of three buttons, respectively, to achieve login, Cancel, Exit function.

2) Design of User entity class (users)
Two private member variables username and password, as well as their getter,setter methods, are constructed as a method.

3) database User table Design
Name type length is empty?
Username varchar 10 is not allowed for null primary key
Password varchar 15 is not allowed to be empty
and add a record to the table, as follows:
Username= "111" password= "111"

4) Design of Login Listener class
Implement login, Cancel, and exit these three button click events.
Login function:
1. If the user name password matches the database in the user table, the login succeeds and enters the main interface.
2. If at least one of the user name passwords is empty, the Prompt box (showmessagedialog) "User name password cannot be empty" appears.
3. If the user name password input error, the prompt box "username password is incorrect, there are 2 opportunities", if more than 3 times input, will automatically exit the system.
Cancellation function:
Click the Cancel button to clear the username and password.
Exit Function:
Click the Exit button and the Ask box (Showconfirmdialog) "Are you sure you want to quit the program?" Select "Yes" to exit. Select "No" to return to the login screen.

2014-12-23
Main interface Design

1) Design of graphical interface of main interface
The main interface contains 3 menus, basic Operation menu, Import Export menu, Help menu.
The basic Operation menu has three items: Add, query, password change, exit.
The Import and Export menu has four items: Import from Excel, import from TXT, export to Excel, export to txt.
The Help menu has two items: about this system, system help.
The main menu interface mainly uses Jmenu,jmenubar,jmenuitem.

2014-12-23
Next is the implementation of the menu item for the main interface help (relatively simple)

1) about the system
I. About the design of the system interface
Using JLabel Design
Displays the name of the system, class, school number, time, producer information.
Name, class, school number, time information is displayed in the center of the window, the producer information is displayed in the bottom right corner of the window. Second, about the system click event
Implemented using the Showaboutsystem () method in the Help system Listener (Helpsystemcontroller).

2) System Help
First, the design of the system help interface
Create a form directly, specify its size, frame.setsize (700,500)
Read and write the TXT file to textarea by File,filereader,bufferedreader. and add up and down scroll bars according to the actual situation.
Second, the system help click the event
Implemented using the Showsystemhelp () method in the Help system Listener (Helpsystemcontroller).

The basic realization of this system.

2014-12-24
Implements the function of the Basic Action menu item

1) exit
First, the design of the Exit interface
The exit interface is just a question box, "Are you sure you want to exit the system?" Select "Yes" to exit the system; Select "No" to return to the main interface Mainview.
Second, exit the Click event
Implemented using the Exitsystem () method in the basic Operation Listener (Baseworkcontroller).

2) Password modification
First, the design of the password modification interface
Password modification interface and landing interface is similar, here is not to say, three password boxes and their corresponding labels, three buttons "modify", "Cancel", "return".

Second, password modification Click event
Implemented using the Showupdatepasswordview () method in the basic Operation Listener (Baseworkcontroller).
Third, realize the function

1. Click "Modify" button, if the original password entered does not match the database, then the prompt box "original password is incorrect."
2. When "New password" and "Confirm password" are different, "show box" two times password inconsistent "please check"
3. Check Password: password length 6-10; password contains at least one digit, one uppercase letter, one lowercase letter, no spaces (this remains in the last write).

3) Increase
The design of database student information table

Name type length is empty?
ID varchar 15 is not allowed for null primary key
Name varchar 15 is not allowed to be empty
Gender varchar 10 is not allowed to be empty
Birth varchar 20 is not allowed to be empty
Province varchar 20 is not allowed to be empty
Interest varchar 50 is not allowed to be empty
PhoneNumber varchar 15 is not allowed to be empty

Second, the information to increase the interface design
Information added interface using BorderLayout layout, divided into top,center,bottom three parts.
The top area defines only one object of the JLabel class and displays the words "fill in the student's basic information".
The center area is a student's basic information, including number, name, gender, birthday, province, specialty, mobile phone number. Where gender is a radio box, the feature is a check box, and the province is a drop-down list. The rest is a single-line text box.
The bottom area has three buttons, "Save", "Cancel", "return".

Third, increase the Click event
Implemented using the Addstudentview () method in the basic Operation Listener (Baseworkcontroller).

IV. Realization of functions
1. All information must be entered or selected, if blank, the Show Prompt box "* * * field cannot be empty"
2. For the number, the requirement is a 10-bit length of pure digits, otherwise the display prompt box "number format is incorrect"
3. Enter the school number can not exist in the database, otherwise display the prompt box "This number already exists"
4. For mobile phone number, the request is a legitimate mobile phone number, otherwise the display prompt box "cell phone number format is incorrect"
5. For birthdays, the requirement is a valid date, that is, the "YYYY-MM-DD" format, otherwise the "entered birthday field is not a valid date" In the Show Prompt box
6. Click "Save", add a record in the database, and display the query box "The information you entered has been successfully saved, continue to enter?", if you click "Yes" then empty the contents of each component and return to "add interface", otherwise return to "main interface";
7. When clicking "Cancel", clear the input or selection of each component.
8. When you click "Back", close the "info add" screen and return to "main screen".

4) Query
First, the design of the query interface
Query graphical interface using BorderLayout layout, divided into top,center,bottom three panels.
Top
Four JLabel, four JTextField, two buttons JButton "Start query", "Empty condition".
Center
DefaultTableModel entity class.
Bottom
Four JButton buttons, "Modify", "delete", "Export to Excel", "return".

Second, increase the Click event
Implemented using the Findview () method in the basic event Listener (Baseworkcontroller).

Third, realize the function
Can be based on the number, name, gender, provincial conditions query, can also be combined query (gender and province only).
Check the information of the query, you can modify or manipulate or delete the function, directly affect the data in the database.
Click Back to return to the main screen.

Basic Operation Basic implementation.

2014-12-25
Implementing the Import and export function

1) Import txt text information to the database
First, the Window interface
With JFileChooser choosertxt=new jfilechooser (), click the "Import from TXT" menu item, pop up the file selection box directly, select the file, and do the operation.

Second, click the event
Implemented using the Showimporttxtview () method in the Import Export Listener (Importexportcontroller).

Third, realize the function
1. When the number of a line in the TXT document repeats with the number in the database table, the number of the line in the message "file" is already present in the database, please check 1! ", and save the information of the number without repetition to the database.
2. If the import is successful, display the message "successfully imported into the database".

2) Import Excel table information to database
First, the Window interface
Same as txt import. With JFileChooser choosertxt=new jfilechooser (), click the "Import from Excel" menu item, directly pop up the file selection box, select the file, and then proceed.

Second, click the event
Implemented using the Showimportexcelview () method in the Import Export Listener (Importexportcontroller).

Third, realize the function
1. When the number of a row in the Excel table is duplicated with the number in the database table, the number of the line in the message "file" is already present in the database, please check 1! ", and save the information of the number without repetition to the database.
2. If the import is successful, display the message "successfully imported into the database".

3) export to TXT document
First, the Window interface
With JFileChooser choosertxt=new jfilechooser (), click on the "Export to TXT" menu item, pop up the file selection box directly, select the file, do the operation.

Second, click the event
Implemented using the Showexporttxtview () method in the Import Export Listener (Importexportcontroller).

Third, realize the function
Save the student information in the database to the TXT document, and implement automatic line wrapping in txt.

4) Export to Ecel document
First, the Window interface
With JFileChooser choosertxt=new jfilechooser (), click on the "Export to Excel" menu item, pop up the file selection box directly, select the file, do the operation.

Second, click the event
Implemented using the Showexportexcelview () method in the Import Export Listener (Importexportcontroller).

Third, realize the function
Save student information from the database to an Excel document.

Import Export Basic implementation.

3. Implementation of main function modules
1. Implementation of the login template
Flow chart:
Login interface design →vo,dao design → Login Event listener
Realize:
Increase the construction method in the Logincontroller class to get the member variable opposite the view. Through GetText () you can get the username and password you entered.
In the Userdao class, add the CheckUser () method, the return value is a Boolean type, to determine whether the user name password is the same as in the database, through Logincontroller call implementation login function, while increasing the time variable, to record the number of input times, When time>3, automatically exits the system. Empty then use the SetText () method to assign the user name password to "". Displays the prompt box with the Showmessagedialog () method and displays the query box with the Showconfirmdialog () method.

2. Implementation of Password modification
Flow chart:
Password modification interface → event listener
Realize:
Similar to the login function. In the Userdao class, add the Checkuserold () method to verify that the old password entered is correct, by calling the implementation. If the number entered is empty, it is better to judge with length () ==0 than Equal ("").

3. Increase the realization of information
Flowchart: Add interface →vo,dao design → add event listener
Realize:
Graphical interface attention to typesetting problems. The implementation of the function is similar to the above. A new drop-down list box, radio button, check box appears.
Drop-down list box:
The contents of the drop-down list box are the provinces, define a provinces array, add individual provinces and "select" to the array, and use the Setmaximumrowcount (7) method to specify a maximum of 7 rows of information. When you click the Cancel button, the content in the drop-down list box changes to "select", and the implementation of the feature is implemented with the Setselecteditem ("select") method. If you decide whether the province is selected, apply GetSelectedItem (). toString (). Equals ( "Please select"). Note: the GetSelectedItem () type is not a String, but an object.
radio button:
The content of the radio button is gender, the Jradiobutton is placed in the butongroup, to achieve the single-selection function, but when the cancellation of the direct call SetSelection (false) is not possible. The solution is to create another Jradiobutton, Do not add this button to the Panel. When you implement cancellation, you only need to call this button. The method to invoke the Hide button is DoClick (). The method to determine whether to select is IsSelected ().
check box:
Determine if it is selected: isSelected (), Empty: SetSelected (false).

The other implementations are the same as the implementation of the password box above.

4. Implementation of System Help
Realize:
I want to use JTextArea to achieve, but the scroll bar function in accordance with several methods on the Internet, can not be achieved. Instead of textarea,
TEXTAREA automatically has scroll bar function. Read the contents of the TXT document by File,filereader,bufferedreader and write textarea through the Append () method.
Seteditable (FALSE): The contents of the TXT document cannot be modified.
\ r \ n: implements the line wrapping function.

5. Implementation of the import and export function
Realize:
Import from TXT, export to txt
The import is mainly used by File,filereader,bufferedreader to read the contents of the TXT document and write the read content to the database through a for loop.
Export: First the data in the database is taken out through the SQL statement, the export path is specified, and the File,write class writes the information to the TXT document using the For statement, thus realizing the export function.
Import from Excel, export to Excel
The operation of the table differs from that of the document. Use to Workbook,sheet.
Import: First instantiate a worksheet, through the dual for Loop, Sheet.getrows (), Sheet.getcolumns () to get the information of each lattice, and then use the dual for loop and the SQL statement to save the information to the database to implement the import.
Export:
Use the three classes of the Writableworkbook,writablesheet,label.
Take the information out of the database first, use for loop, through Addcell () each field into the table, to implement the import function.

6. Implementation of the query function
Realize:
The main thing is the implementation of the 6 buttons.
Query button:
The query function is relatively simple. Call Studentinformationdao in Byid (), byname (), Bygender (), Byprovince () method implementation. If no information is found, the dialog box "query does not find the field, Please check that the input is incorrect. "
Purge Condition:
Use the SetText () method to set the values in each TextField to null.
Modify:
Modify the interface and add the same interface, with the mouse click to get a line of information, the information displayed in the modification interface, click Save, delete the original information from the database, the modified information saved to the database. For radio buttons and check boxes, use SetSelected (true) to indicate the selection.
Delete:
The information that is queried is stored in the list table, a row that is clicked by the mouse, and the Delinformation () method that operates on the database, deletes the selected row of information from the database, and also deletes the row information in the table.
Export to Excel table:
The Export to Excel table method encountered in the import export is identical and does not explain.
Note that the increment of the i,j,m,u variable is in the last two for loop.
Return:
Hides the Findview window. setvisible (False);


4. Deficiencies in the system
1. The function realizes, but the interface is not beautiful, too monotonous.
2. Some of the code is too cumbersome. (Can't find a better way to do it)

5. The harvest of this course

This course has taught me a lot. Basic Java syntax, ArrayList, menus, Java IO, database manipulation, Java graphical interface programming,
Learn Java programming, the most important thing is the graphical interface.
Steps to create a graphical interface:
1. Create the interface container.
2. Create a layout for the container.
3. Add a base component or other container to the container.
4. Use listeners to respond to various events.
The Java file is then packaged to generate a runnable. jar file (the computer must have a JRE to run directly) and then use Jsmooth to generate the EXE file, which is what we want to get.

6. Recommendations of the course
More homework, more practice to be able to master.


7. Future direction of development
Interested in the development of Andriod mobile applications.

PS: The source code will be uploaded in succession.

Student Information Management System-----Documentation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.