Students Profile Management
Students Profile Management
1|Page
TITLE :
STUD
ENT
PROFI
2|Page
t
Serial
Content Page No.
No.
1. AIM 4
2. INTRODUCTION 4
3. PACKAGES 5
4. PROGRAM DETAILS 7
5. SOURCE CODE 14
6. OUTPUT 28
CONTENT
AIM
3|Page
Develop a java based application using GUI to maintain
student record. The application should have a login page. The
application should take student details like name, address,
branch, previous year scores, curricular and extra-curricular
activities and all the entered data should be displayed in the
end for conformation.
INTRODUCTION
A GUI (graphical user interface) is a system of interactive
components such as icons and other graphical objects that
help a user interact with computer software, such as
an operating system.
A GUI is considered to be more user-friendly than a text-
based command-line-interface , such as MS-DOS, or the
shell of Unix-like operating systems.
The GUI was first developed at Xerox-PARC by Alan Kay,
DogulasEngleBart , and a group of other researchers in 1981.
Later, Apple introduced the Lisa computer with a GUI on
January 19, 1983.
A GUI uses windows, icons, and menu to carry out
commands, such as opening, deleting, and moving files.
Although a GUI operating system is primarily navigated using
a mouse, a keyboard can also be used via keyboard
shortcuts or the arrow keys.
Packages
javax.swing
4|Page
Java Swing tutorial is a part of Java Foundation Classes
(JFC) that is used to create window-based applications. It is
built on the top of AWT (Abstract Windowing Toolkit) API
and entirely written in java.Unlike AWT, Java Swing provides
platform-independent and lightweight components.
The javax.swing package provides classes for java swing API
such as JButton, JTextField, JTextArea, JRadioButton,
JCheckbox, JMenu, JColorChooser etc.
java.awt
The java.awt package is the main package of the AWT, or
Abstract Windowing Toolkit. It contains classes for graphics,
including the Java 2D graphics capabilities introduced in the
Java 2 platform, and also defines the basic graphical user
interface (GUI) framework for Java. The most important
graphics classes in java.awt are Graphics and its Java 2D
extension, Graphics2D. These classes represent a drawing
surface, maintain a set of drawing attributes, and define
methods for drawing and filling lines, shapes, and text.
Classes that represent graphgics attributes include Color,
Font, Paint, Stroke, and Composite.
java.awt.event
The java.awt.event package defines classes and interfaces
used for event handling in the AWT and Swing. The
members of this package fall into three categories: Events.
5|Page
The classes with names ending in "Event" represent specific
types of events, generated by the AWT or by one of
the AWT or Swing components.
java.io.file
Java.io package provides classes for system input and output
through files, network streams, memory buffers, etc.
Some input-output stream will be initialized automatically
by the JVM and these streams are available in System class as
in, out, and err variable.
javax.swing.filechooser.FileNameExtensionFilter
An implementation of FileFilter that filters using a specified
set of extensions. The extension for a file is the portion of the
file name after the last ".". Files whose name does not contain
a "." have no file name extension.
java.util.Scanner
Scanner Class in Java. Scanner is a class in java.util
package used for obtaining the input of the primitive types
like int, double, etc. and strings. ... next() function returns the
next token/word in the input as a string and charAt(0) function
returns the first character in that string.
Program Details –
1) LoginFrame :
6|Page
Login Frame is GUI based window that is displayed
when the user first executes the program. It is the
welcome page through which user will move on to the
next frame.
It contains a button with an ActionListener() which on
pressing opens Frame2.
2) Frame2 :
Frame2 is login page. This page takes user id and
password as input and only after successful verification
of user the user is allowed to move to next page.
The default user id password is
User id :- admin
Password :- admin1234
3) Frame3 :
Frame3 is where the user is given the option to enter
their details such as name, age, branch, address and
select their gender from the drop-down menu. Each
detail to be entered are stored using JTextField() and
JRadioButton is used to display the drop-down menu for
the gender selection. Finally, there is the submit details
7|Page
button which on pressing triggers ActionListener() and
checks whether the user given input is legitimate or not,
if it is not then it pops a alert message that reminds the
user to enter the correct details. Once the correct input is
given, we pass this information onto Frame4.
4) Frame4 :
Frame4 is where the user is given the option to enter
their details such as their previous academics
achievements, their 10th,12th scores, their average pointer,
their extra-curricular and co-curricular activites. Each
detail to be entered are stored using JTextField() and
JRadioButton is used to display the drop-down menu for
the gender selection. Finally, there is the submit details
button which on pressing triggers ActionListener() and
checks whether the user given input is legitimate or not,
if it is not then it pops a alert message that reminds the
user to enter the correct details. Once the correct input is
given, we pass this information onto Frame5.
5) Frame5 :
8|Page
Frame5 class is where we receive the user input taken in
Frame3 and Frame4 and using JLabel()’s we display it
on our Java application windows. There are two buttons
to either make a new entry or to exit. On clicking on the
first button, ActionListener() is triggered which calls
Frame3() and thus we can enter details of the another
entry.
6) Student Detials :
This is the final class that contains the main method,
which calls the LoginFrame() .
9|Page
AWT/Swing Functions Used –
1) ActionListener :
ActionListener in Java is a class that is responsible in
handling all action events such as when user clicks in
component, like JButton, the moment user clicks on it,
the ActionListener immediately enforces the action
which was programmed by the programmer.
E.g.
b1.addActionListener( new ActionListener()
{
Public void actionPerformed(ActionEvent e)
{
LoginFrame.this.setVisible(false);
new Frame2();
}
});
In this example we can see that an ActionListener is
added to the JButton b1, then an action is programmed to
take place using the actionPerformed() function. “new
Frame2()” is action set by the user that creates a new
Frame
10 | P a g e
2) JFrame :
3) JButton :
11 | P a g e
JButton(Icon i) – To create a button with a specified
icon object.
3) JLabel :
12 | P a g e
JTextField is a part of javax.swing package. The class
JTextField is a component that allows editing of a single
line of text. JTextField inherits the JTextComponent class
and uses the interface SwingConstants.
13 | P a g e
SOURCE CODE
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.io.File;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.util.*;
l1 = new JLabel();
l1.setBounds(200, 30 , 700 , 300);
14 | P a g e
l1.setIcon(new ImageIcon("9.jpg"));
add(l1);
t1 = new JTextField();
15 | P a g e
t1.setBounds(230,150,200,30);
add(t1);
t2 = new JTextField();
t2.setBounds(230 , 190 , 200 , 30);
add(t2);
b1 = new JButton("LOGIN");
b1.setBounds(150 , 330 , 150, 30);
add(b1);
b1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
if(t1.getText().equals(""))
{
JOptionPane.showMessageDialog(Frame2.this,"Please
Enter
USERNAME","ALERT",JOptionPane.ERROR_MESSAGE);
return;
}
else if(t2.getText().equals(""))
{
JOptionPane.showMessageDialog(Frame2.this,"Please Enter
PASSWORD","ALERT",JOptionPane.ERROR_MESSAGE);
return;
}
16 | P a g e
else if(t1.getText().equals("admin") &&
t2.getText().equals("admin1234"))
{
Frame2.this.setVisible(false);
new Frame3();
}
else
{
JOptionPane.showMessageDialog(Frame2.this,"USERID OR
WORNG IS
WORNG","ALERT",JOptionPane.ERROR_MESSAGE);
return;
}
}
});
setVisible(true);
}
}
class Frame3 extends JFrame
{
JLabel l1,l2,l3,l4,l5,l6,l7;
JTextField t1,t2,t3,t4,t5;
JButton b1, b2, b3;
String data;
public Frame3()
{
super("STUDENT DETAILS");
setSize(500 , 500);
setResizable(true);
setLocation(200 , 50);
setLayout(null);
17 | P a g e
setDefaultCloseOperation(EXIT_ON_CLOSE);
l1 = new JLabel("ENTER FIRST NAME ");
l1.setBounds(80 , 50 , 150 , 30);
add(l1);
t1 = new JTextField();
t1.setBounds(230 , 50 , 200 , 30);
add(t1);
t2 = new JTextField();
t2.setBounds(230 , 100 , 200 , 30);
add(t2);
l3 = new JLabel("SELECT GENDER ");
l3.setBounds(80,150,150,30);
add(l3);
t5 = new JTextField();
t5.setBounds(230,150,200,30);
add(t5);
t3 = new JTextField();
t3.setBounds(230 , 190 , 200 , 30);
add(t3);
t4 = new JTextField();
t4.setBounds(230 , 230 , 200 , 30);
add(t4);
20 | P a g e
String data;
t1 = new JTextField();
t1.setBounds(270 , 50 , 200 , 30);
add(t1);
t2 = new JTextField();
t2.setBounds(270 , 100 , 200 , 30);
add(t2);
l3 = new JLabel("ENTER YOUR AVERAGE
POINTER: ");
l3.setBounds(40,150,200,30);
add(l3);
21 | P a g e
t5 = new JTextField();
t5.setBounds(270,150,200,30);
add(t5);
t3 = new JTextField();
t3.setBounds(270 , 190 , 200 , 30);
add(t3);
t4 = new JTextField();
t4.setBounds(270 , 230 , 200 , 30);
add(t4);
b2 = new JButton("CONTINUE");
b2.setBounds(150 , 330 , 150, 30);
add(b2);
b2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
if(t1.getText().equals(""))
{
22 | P a g e
JOptionPane.showMessageDialog(Frame4.this,"Please
Enter SSC
PERCENTAGE","ALERT",JOptionPane.PLAIN_MESSAGE
);
return;
}
else if(t2.getText().equals(""))
{
JOptionPane.showMessageDialog(Frame4.this,"Please Enter
HSC MARKS","ALERT",JOptionPane.PLAIN_MESSAGE);
}
else if(t5.getText().equals(""))
{
JOptionPane.showMessageDialog(Frame4.this,"Please Enter
AVERAGE
POINTER","ALERT",JOptionPane.PLAIN_MESSAGE);
}
else if(t3.getText().equals(""))
{
JOptionPane.showMessageDialog(Frame4.this,"Please Enter
COMMITTE
NAME","ALERT",JOptionPane.PLAIN_MESSAGE);
}
else if(t4.getText().equals(""))
{
JOptionPane.showMessageDialog(Frame4.this,"Please Enter
NTEPL
COURSE","ALERT",JOptionPane.PLAIN_MESSAGE);
}
else
23 | P a g e
{
String s9 = "SSC PERCENTAGE
"+t1.getText().trim();
String s10 = "HSC PERCENTAGE
"+t2.getText().trim()+"\n";
String s11 = " COMMITTE: "+t4.getText().trim();
String s12 = "NTEPL COURSE NAME :
"+t3.getText().trim();
String s13 = "AVERAGE POINTER :
"+t5.getText().trim();
Frame4.this.setVisible(false);
new Frame5(s5,s6,s7,s8,s9,s10,s11,s12,s13);
}
}
});
setVisible(true);
}
}
class Frame5 extends JFrame
{
JLabel l1 , l2, l3, l4, l5,l6,l7,l8,l9,l10;
JButton b1, b2;
24 | P a g e
l1 = new JLabel(s1);
l1.setBounds(50 , 20 , 300 , 30);
add(l1);
l4 = new JLabel(s4);
l4.setBounds(50 , 70 , 300 , 30);
add(l4);
l2 = new JLabel(s2);
l2.setBounds(50 , 120 , 300 , 30);
add(l2);
l3 = new JLabel(s3);
l3.setBounds(50 , 170 , 300 , 30);
add(l3);
l5 = new JLabel(s5);
l5.setBounds(50 , 220 , 300 , 30);
add(l5);
l6 = new JLabel(s6);
l6.setBounds(50 , 270 , 300 , 30);
add(l6);
l7 = new JLabel(s7);
l7.setBounds(50 , 320 , 300 , 30);
add(l7);
l8 = new JLabel(s8);
l8.setBounds(50 , 370 , 300 , 30);
add(l8);
l9 = new JLabel(s9);
l9.setBounds(50 , 420 , 300 , 30);
25 | P a g e
add(l9);
setVisible(true);
}
}
public class Studentdetails
{
public static void main(String [] args)
{
new LoginFrame();
26 | P a g e
}
}
OUTPUT
Welcome page
27 | P a g e
Login Frame
Credential verification
28 | P a g e
User input
29 | P a g e
Additional inputs
30 | P a g e
Displaying user details
31 | P a g e
Making new entry
32 | P a g e
CONCLUSION:
33 | P a g e