Java Course Design (Student Information management system)

Source: Internet
Author: User
Tags chr gettext

1. Demand Analysis

Functional Requirements:
1) Student information that needs to be managed is: study number, name, gender, date of birth, political appearance, home address, telephone, dorm number.
2) Implementation of query, add, delete, change and other functions.
Data storage: Database or file.

2. This group of topics and my task

The subject of this group is student information Management system, I am responsible for the task is to complete the Student Information Management system graphical interface.

3. Overall design (summary design)

This group completed the Student Information management system, the main functions of the increase, delete, check, change, the management of student information has school number, name, gender, date of birth, political appearance, home address, telephone, dormitory number. and use a database to store student information.

Group members
Weng Huahui: Responsible for the completion of the Student Information Management system graphical interface,

Zhang Yuyang: Responsible for the preparation of Student information management system additions and deletions to check.

Operating interface:

Specific code:
Login interface:
To the width height of the screen, the width of the program window is assigned a value
Dimension Dimension = Toolkit.getdefaulttoolkit (). Getscreensize ();
Screensizewidth = (int) dimension.getwidth ();
Screensizeheight = (int) dimension.getheight ();
WindowWidth = This.getwidth ();
WindowHeight = This.getheight ();
Set the location of the program window to the right center of the screen
This.setlocation (SCREENSIZEWIDTH/2-WINDOWWIDTH/2, SCREENSIZEHEIGHT/2-WINDOWHEIGHT/2);

Label of the name, password
JLabel Username_label = new JLabel ("User:");
JLabel Password_label = new JLabel ("Password:");
JLabel Administrator_label = new JLabel ("admin login");

Declare Name entry box and password entry box
Final JTextField User_field = new JTextField ();
Final JPasswordField Password_field = new JPasswordField ();

DECLARE login button
JButton login_btn = new JButton ("login");
JButton exit_btn = new JButton ("Exit");

Set the size and position of individual labels and input boxes
Username_label.setbounds (110, 100, 150, 50);
Password_label.setbounds (110, 200, 150, 50);
Administrator_label.setbounds (280, 50, 100, 50); 280, 60, 100, 30
User_field.setbounds (180, 100, 300, 50);
Password_field.setbounds (180, 200, 300, 50);
Login_btn.setbounds (200, 300, 100, 50);
Exit_btn.setbounds (350, 300, 100, 50);

Add to Panel
This.add (Username_label);
This.add (Password_label);
This.add (User_field);
This.add (Password_field);
This.add (LOGIN_BTN);
This.add (EXIT_BTN);
This.add (Administrator_label);

Login Password Service:
//Login button Listener
Login_btn.addactionlistener (New ActionListener ()
{
@SuppressWarnings (" Deprecation ")
@Override
//Automatically transfer this method when the button is clicked
public void actionperformed (ActionEvent event)
{
// If both the user name and password are 123, the popup dialog box displays the login success and opens another main frame (home)
if (User_field.gettext (). Equals (userName) && Password_ Field.gettext (). Equals (password))
{
Joptionpane.showmessagedialog (null, "Login succeeded", "login", Joptionpane.information_message);
//Claim home
JFrame home_page = new JFrame ("Student Information Management System");
Home_page.setresizable (FALSE);
Home_page.setsize (600, 600);//Set the size of the window
Home_page.setlayout (null);//Set the default layout format for the program to be empty, so that you can easily set the layout
Home_ Page.setresizable (FALSE); Set non-scalable

Set a location for the home page
Home_page.setlocation (SCREENSIZEWIDTH/2-WINDOWWIDTH/2 +, SCREENSIZEHEIGHT/2-WINDOWHEIGHT/2 + 50);
To set the size of a page
Home_page.setsize (WindowWidth, windowheight);
Set the home page to close and hide the login page after successful login
Home_page.setdefaultcloseoperation (Jframe.exit_on_close);
Home_page.setvisible (TRUE);
SetVisible (false);//Login page Hidden

Feature Selection interface
JLabel Menu_label = new JLabel ("Welcome to Student Information Management system!!!");

DECLARE login button
JButton write_btn = new JButton ("1. Add student Information");
JButton delate_btn = new JButton ("2. Delete Student Information");
JButton read_btn = new JButton ("3. Modify student Information");
JButton display_btn = new JButton ("4. View student Information");
JButton exit1_btn = new JButton ("5. Exit system");

Set the size and position of individual labels and input boxes
Menu_label.setbounds (200, 15, 300, 200);
Write_btn.setbounds (200, 150, 150, 50);
Delate_btn.setbounds (200, 200, 150, 50);
Read_btn.setbounds (200, 250, 150, 50);
Display_btn.setbounds (200, 300, 150, 50);
Exit1_btn.setbounds (200, 350, 150, 50);
Add to Panel
Home_page.add (Menu_label);
Home_page.add (WRITE_BTN);
Home_page.add (DELATE_BTN);
Home_page.add (READ_BTN);
Home_page.add (DISPLAY_BTN);
Home_page.add (EXIT1_BTN);

Add Students:
Add Listener for Student Info button
Write_btn.addactionlistener (New ActionListener ()
{
@SuppressWarnings ("deprecation")
@Override
This method is automatically transferred when the button is clicked
public void actionperformed (ActionEvent event)
{

JFrame write_page = new JFrame ("Student Information Management system");
Write_page.setresizable (FALSE);
Write_page.setsize (600, 600); Set the size of the window
Write_page.setlayout (NULL); Set the default layout of the program to empty so that you can easily set the layout later
Write_page.setresizable (FALSE); Set non-scalable

Set a location for the home page
Write_page.setlocation (screensizewidth/2-windowwidth/2+50, SCREENSIZEHEIGHT/2-WINDOWHEIGHT/2 + 50);
To set the size of a page
Write_page.setsize (WindowWidth, windowheight);
Set the home page to close and hide the login page after successful login
Write_page.setdefaultcloseoperation (Jframe.exit_on_close);
Write_page.setvisible (TRUE);
SetVisible (false);//Login page Hidden

Declaration Label, Button,
JLabel Menu1_label = new JLabel ("Add student Information");
JLabel Id1_label = new JLabel ("ID");
JLabel Name1_label = new JLabel ("name");
JLabel Gender1_label = new JLabel ("gender");
JLabel Birthdate1_label = new JLabel ("BirthDate");
JLabel Politicaloutlook1_label = new JLabel ("Politicaloutlook");
JLabel Familylocate1_label = new JLabel ("Familylocate");
JLabel Phone1_label = new JLabel ("Phone");
JLabel Dormitorynum1_label = new JLabel ("Dormitorynum");

Final JTextField Id1_field = new JTextField ();
Final JTextField Name1_field = new JTextField ();
Final JTextField Gender1_field = new JTextField ();
Final JTextField Birthdate1_field = new JTextField ();
Final JTextField Politicaloutlook1_field = new JTextField ();
Final JTextField Familylocate1_field = new JTextField ();
Final JTextField Phone1_field = new JTextField ();
Final JTextField Dormitorynum1_field = new JTextField ();

JButton return1_btn = new JButton ("return");
JButton sure1_btn = new JButton ("OK");
JButton exit2_btn = new JButton ("Exit system");

Set the size and position of individual labels and input boxes
Menu1_label.setbounds (250, 75, 100, 100);

Id1_label.setbounds (200, 150, 100, 50);
Name1_label.setbounds (200, 190, 100, 50);
Gender1_label.setbounds (200, 230, 100, 50);
Birthdate1_label.setbounds (200, 270, 100, 50);
Politicaloutlook1_label.setbounds (200, 310, 100, 50);
Familylocate1_label.setbounds (200, 350, 100, 50);
Phone1_label.setbounds (200, 390, 100, 50);
Dormitorynum1_label.setbounds (200, 430, 100, 50);

Id1_field.setbounds (300, 160, 80, 25);
Name1_field.setbounds (300, 200, 80, 25);
Gender1_field.setbounds (300, 240, 80, 25);
Birthdate1_field.setbounds (300, 280, 80, 25);
Politicaloutlook1_field.setbounds (300, 320, 80, 25);
Familylocate1_field.setbounds (300, 360, 80, 25);
Phone1_field.setbounds (300, 400, 80, 25);
Dormitorynum1_field.setbounds (300, 440, 80, 25);

Return1_btn.setbounds (120, 500, 100, 50);
Sure1_btn.setbounds (250, 500, 100, 50);
Exit2_btn.setbounds (380, 500, 100, 50);

Add to Panel

Write_page.add (Menu1_label);
Write_page.add (Id1_label);
Write_page.add (Name1_label);
Write_page.add (Gender1_label);
Write_page.add (Birthdate1_label);
Write_page.add (Politicaloutlook1_label);
Write_page.add (Familylocate1_label);
Write_page.add (Phone1_label);
Write_page.add (Dormitorynum1_label);

Write_page.add (Id1_field);
Write_page.add (Name1_field);
Write_page.add (Gender1_field);
Write_page.add (Birthdate1_field);
Write_page.add (Politicaloutlook1_field);
Write_page.add (Familylocate1_field);
Write_page.add (Phone1_field);
Write_page.add (Dormitorynum1_field);

Write_page.add (RETURN1_BTN);
Write_page.add (SURE1_BTN);
Write_page.add (EXIT2_BTN);

Delete student:
Delete the Student Information button listener
Delate_btn.addactionlistener (New ActionListener ()
{
@SuppressWarnings ("deprecation")
@Override
This method is automatically transferred when the button is clicked
public void actionperformed (ActionEvent event)
{
JFrame delate_page = new JFrame ("Student Information Management system");

Delate_page.setresizable (FALSE);
Delate_page.setsize (600, 600); Set the size of the window
Delate_page.setlayout (NULL); Set the default layout of the program to empty so that you can easily set the layout later
Delate_page.setresizable (FALSE); Set non-scalable

Set a location for the home page
Delate_page.setlocation (SCREENSIZEWIDTH/2-WINDOWWIDTH/2 +, SCREENSIZEHEIGHT/2-WINDOWHEIGHT/2 + 50);
To set the size of a page
Delate_page.setsize (WindowWidth, windowheight);
Set the home page to close and hide the login page after successful login
Delate_page.setdefaultcloseoperation (Jframe.exit_on_close);
Delate_page.setvisible (TRUE);
SetVisible (false);//Login page Hidden

Statement
JLabel Menu2_label = new JLabel ("Delete student Information");
JLabel Id2_label = new JLabel ("Please enter ID");
Final JTextField Id2_field = new JTextField ();

JButton return2_btn = new JButton ("return");
JButton sure2_btn = new JButton ("OK");
JButton exit3_btn = new JButton ("Exit system");

Set the size and position of individual labels and input boxes
Menu2_label.setbounds (250, 75, 100, 100);

Id2_label.setbounds (180, 200, 200, 50);
Id2_field.setbounds (300, 210, 80, 25);

Return2_btn.setbounds (120, 400, 100, 50);
Sure2_btn.setbounds (250, 400, 100, 50);
Exit3_btn.setbounds (380, 400, 100, 50);

Add to Panel
Delate_page.add (Menu2_label);
Delate_page.add (Id2_label);
Delate_page.add (Id2_field);
Delate_page.add (RETURN2_BTN);
Delate_page.add (SURE2_BTN);
Delate_page.add (EXIT3_BTN);

To modify student information:
/Modify the Student Information button listener
Read_btn.addactionlistener (New ActionListener ()
{
@SuppressWarnings ("deprecation")
@Override
This method is automatically transferred when the button is clicked
public void actionperformed (ActionEvent event)
{
JFrame read_page = new JFrame ("Student Information Management system");

Read_page.setresizable (FALSE);
Read_page.setsize (600, 600); Set the size of the window
Read_page.setlayout (NULL); Set the default layout of the program to empty so that you can easily set the layout later
Read_page.setresizable (FALSE); Set non-scalable

Set a location for the home page
Read_page.setlocation (SCREENSIZEWIDTH/2-WINDOWWIDTH/2 +, SCREENSIZEHEIGHT/2-WINDOWHEIGHT/2 + 50);
To set the size of a page
Read_page.setsize (WindowWidth, windowheight);
Set the home page to close and hide the login page after successful login
Read_page.setdefaultcloseoperation (Jframe.exit_on_close);
Read_page.setvisible (TRUE);
SetVisible (false);//Login page Hidden

Declaration Label, Button,
JLabel Menu3_label = new JLabel ("Modify student Information");
JLabel Xiugaiid_label = new JLabel ("Please enter the ID of the student to be modified:");

JLabel Id3_label = new JLabel ("ID");
JLabel Name3_label = new JLabel ("name");
JLabel Gender3_label = new JLabel ("gender");
JLabel Birthdate3_label = new JLabel ("BirthDate");
JLabel Politicaloutlook3_label = new JLabel ("Politicaloutlook");
JLabel Familylocate3_label = new JLabel ("Familylocate");
JLabel Phone3_label = new JLabel ("Phone");
JLabel Dormitorynum3_label = new JLabel ("Dormitorynum");

Final JTextField Id3_field = new JTextField ();
Final JTextField Xiugaiid_field = new JTextField ();
Final JTextField Name3_field = new JTextField ();
Final JTextField Gender3_field = new JTextField ();
Final JTextField Birthdate3_field = new JTextField ();
Final JTextField Politicaloutlook3_field = new JTextField ();
Final JTextField Familylocate3_field = new JTextField ();
Final JTextField Phone3_field = new JTextField ();
Final JTextField Dormitorynum3_field = new JTextField ();

JButton return3_btn = new JButton ("return");
JButton sure3_btn = new JButton ("OK");
JButton exit4_btn = new JButton ("Exit system");

Set the size and position of individual labels and input boxes
Menu3_label.setbounds (250, 50, 100, 100);
Xiugaiid_label.setbounds (200, 75, 100, 100);

Id3_label.setbounds (200, 150, 200, 50);
Name3_label.setbounds (200, 190, 100, 50);
Gender3_label.setbounds (200, 230, 100, 50);
Birthdate3_label.setbounds (200, 270, 100, 50);
Politicaloutlook3_label.setbounds (200, 310, 100, 50);
Familylocate3_label.setbounds (200, 350, 100, 50);
Phone3_label.setbounds (200, 390, 100, 50);
Dormitorynum3_label.setbounds (200, 430, 100, 50);

Xiugaiid_field.setbounds (300, 120, 80, 25);

Id3_field.setbounds (300, 160, 80, 25);
Name3_field.setbounds (300, 200, 80, 25);
Gender3_field.setbounds (300, 240, 80, 25);
Birthdate3_field.setbounds (300, 280, 80, 25);
Politicaloutlook3_field.setbounds (300, 320, 80, 25);
Familylocate3_field.setbounds (300, 360, 80, 25);
Phone3_field.setbounds (300, 400, 80, 25);
Dormitorynum3_field.setbounds (300, 440, 80, 25);

Return3_btn.setbounds (120, 500, 100, 50);
Sure3_btn.setbounds (250, 500, 100, 50);
Exit4_btn.setbounds (380, 500, 100, 50);

Add to Panel

Read_page.add (Xiugaiid_label);
Read_page.add (Xiugaiid_field);

Read_page.add (Menu3_label);
Read_page.add (Id3_label);
Read_page.add (Name3_label);
Read_page.add (Gender3_label);
Read_page.add (Birthdate3_label);
Read_page.add (Politicaloutlook3_label);
Read_page.add (Familylocate3_label);
Read_page.add (Phone3_label);
Read_page.add (Dormitorynum3_label);

Read_page.add (Id3_field);
Read_page.add (Name3_field);
Read_page.add (Gender3_field);
Read_page.add (Birthdate3_field);
Read_page.add (Politicaloutlook3_field);
Read_page.add (Familylocate3_field);
Read_page.add (Phone3_field);
Read_page.add (Dormitorynum3_field);

Read_page.add (RETURN3_BTN);
Read_page.add (SURE3_BTN);
Read_page.add (EXIT4_BTN);

View student Information:
To view the Student Information button's listener
Display_btn.addactionlistener (New ActionListener ()
{
@SuppressWarnings ("deprecation")
@Override
This method is automatically transferred when the button is clicked
public void actionperformed (ActionEvent event)
{
JFrame display_page = new JFrame ("Student Information Management system");

Display_page.setresizable (FALSE);
Display_page.setsize (600, 600); Set the size of the window
Display_page.setlayout (NULL); Set the default layout of the program to empty so that you can easily set the layout later
Display_page.setresizable (FALSE); Set non-scalable

Set a location for the home page
Display_page.setlocation (SCREENSIZEWIDTH/2-WINDOWWIDTH/2 +, SCREENSIZEHEIGHT/2-WINDOWHEIGHT/2 + 50);
To set the size of a page
Display_page.setsize (WindowWidth, windowheight);
Set the home page to close and hide the login page after successful login
Display_page.setdefaultcloseoperation (Jframe.exit_on_close);
Display_page.setvisible (TRUE);
SetVisible (false);//Login page Hidden

JLabel Menu4_label = new JLabel ("View student Information");
JLabel Id4_label = new JLabel ("Please enter ID");
Final JTextField Id4_field = new JTextField ();

JButton return4_btn = new JButton ("return");
JButton sure4_btn = new JButton ("OK");
JButton exit5_btn = new JButton ("Exit system");

Set the size and position of individual labels and input boxes
Menu4_label.setbounds (250, 75, 100, 100);

Id4_label.setbounds (180, 200, 200, 50);
Id4_field.setbounds (300, 210, 80, 25);

Return4_btn.setbounds (120, 400, 100, 50);
Sure4_btn.setbounds (250, 400, 100, 50);
Exit5_btn.setbounds (380, 400, 100, 50);

Add to Panel
Display_page.add (Menu4_label);
Display_page.add (Id4_label);
Display_page.add (Id4_field);
Display_page.add (RETURN4_BTN);
Display_page.add (SURE4_BTN);
Display_page.add (EXIT5_BTN);

Exit System:
Exit the System button listener
Exit5_btn.addactionlistener (New ActionListener ()
{
@SuppressWarnings ("deprecation")
@Override
This method is automatically transferred when the button is clicked
public void actionperformed (ActionEvent event)
{
System.exit (0);
}
});

constructor function:
Switch (str) {
Case 1:
System.out.println ("=========== Show all Student Information ========");
Sdm.diplayallstudent ();
Break

            Case 2:system.out.println ("=========== Writing student Information ========"); Students stu = new Students (Sc.nextint (), Sc.next (), Sc.next (), Sc.next (), Sc.next (), Sc.next (), Sc.nextint (), Sc.nextint                ());                if (Sdm.writestudent (stu)) {System.out.println ("add success");                        } break;                Case 3:system.out.println ("=========== Delete student information ========");                    while (true) {String str2=sc.next ();                    Boolean isnum = false;                           for (int i=str2.length ();--i>=0;) {int Chr=str2.charat (i);                        if (chr<48 | | chr>57) Isnum = true;                            } if (!isnum) {int id2 = Integer.parseint (STR2); if (Sdm.deletestudent (ID2)) {System.out.println ("deleteExcept success "); }} else{if (Str2.equals ("Exit                        ")) break;                            else if (sdm.deletestudent (str2)) {System.out.println ("delete succeeded");                        }}} break;                                Case 4:SYSTEM.OUT.PRINTLN ("=========== Modify student Information ========");                            Break                Case 5:system.out.println ("=========== Inquiry student Information ========");                System.out.println ("Please enter name or school number");                    while (true) {String str1=sc.nextline ();                    Boolean Bol = false;                           for (int i=str1.length ();--i>=0;) {int Chr=str1.charat (i);    if (chr<48 | | chr>57) BOL = true;                    } if (BOL) {int Id1=integer.parseint (                        STR1);                        if (!sdm.readstudent (ID1)) {System.out.println ("no person found");                    }} if (!sdm.readstudent (str1)) {System.out.println ("no person found");                    } if (Str1.equals ("Exit")) break;                        } break;            Case 6:break; }}}public Static Boolean isnumeric (String str) {//Determines whether the string is a number for (int i=str.length ();--i>=0;) {int chr=s       Tr.charat (i);    if (chr<48 | | chr>57) return FALSE; } return true;

}

Week Time Total code Amount New Code Volume total number of files number of new files
1 44 44 2 2
2 213 213 10 5
3 417 204 10 5
5 676 259 17 7
6 1071 405 24 7
7 1780 709 30 6
8 1900 120 35 5
9 2335 435 41 6
10 2767 432 48 7
11 3321 595 57 9
12 3601 280 63 6
13 4131 531 67 4
14 4537 50W 73 6
15 4957 440 44 4
20 8102 2145 65 21st

Git address: https://gitee.com/xinqingnian001/javalearn/commit/f0d4509eb55c6445b74346ba1b4f110706e266c7

Java Course Design (Student Information management system)

Related Article

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.