Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

EX NO:11 MINI PROJECT Date:

CREATING SIMPLE FORMS

CHAPTER 1: PROJECT DESCRIPTION

1.1 Introduction about the project :

In Java, a form for entering authentication credentials to access the restricted page is referred to
as a Login form. A login form contains only two fields, i.e., username and password. Each user
should have a unique username that can be an email, phone number, or any custom username.
After submitting the login form, the underlying code of the form checks whether the credentials
are authentic or not to allow the user to access the restricted page. If the users provide
unauthentic credentials, they will not be able to forward the login form. In java, we can develop
the login form by using Swing technology. We implement the LoginFormDemo.java class in
which we create two text fields, i.e., text1 and text2, for setting the username and password. We
also create a button for performing the action. Swing is a Java Foundation Classes [JFC] library
and an extension of the Abstract Window Toolkit [AWT]. Swing offers much-improved
functionality over AWT, new components, expanded components features, excellent event
handling with drag and drop support. Swing has about four times the number of User Interface
[UI] components as AWT and is part of the standard Java distribution. By today’s application
GUI requirements, AWT is a limited implementation, not quite capable of providing the
components required for developing complex GUI’s required in modern commercial
applications. The AWT component set has quite a few bugs and really does take up a lot of
system resources when compared to equivalent Swing resources. Netscape introduced its Internet
Foundation Classes [IFC] library for use with Java. Its Classes became very popular with
programmers creating GUI’s for commercial applications.
● Swing is a Set Of API ( API- Set Of Classes and Interfaces )
● Swing is Provided to Design a Graphical User Interfaces
● Swing is an Extension library to the AWT (Abstract Window Toolkit)
● Includes New and improved Components that have been enhancing the looks and

Functionality of GUI’s

211521104179 VIKNESH K S
● Swing can be used to build(Develop) The Standalone swing GUI Apps Also as
Servlets And Applets
● It Employs model/view design architecture
● Swing is more portable and more flexible than AWT, The Swing is built on top of the
AWT
● Swing is Entirely written in Java
● Java Swing Components are Platform-independent And The Swing Components are
lightweight
● Swing Supports Pluggable look and feels And Swing provides more powerful
components
● such as tables, lists, Scrollpanes, Colourchooser, tabbedpane, etc
● Further Swing Follows MVC
Many programmers think that JFC and Swing is one and the same thing, but that is not so.

JFC contains Swing [A UI component package] and quite a number of other items:

● Cut and paste: Clipboard support


● Accessibility features: Aimed at developing GUI’s for users with disabilities
● The Desktop Colors Features Has been Firstly introduced in Java 1.1
● The Java 2D: it has Improved colors, images, and also texts support Features Of
Swing Class
● Pluggable look and feel ● Uses MVC architecture
● Lightweight Components
● Platform Independent
● Advance features such as JTable, JTabbedPane, JScollPane etc
● Java is a platform-independent language and runs on any client machine, the GUI
look and feel, owned and delivered by a platform specific O/S, simply does not affect
an application’s GUI constructed using Swing components
● Lightweight Components: Starting with the JDK 1.1, its AWT supported
lightweight component development. For a component to qualify as lightweight, it

211521104179 VIKNESH K S
must not depend on any non-Java [O/s based) system classes. Swing components
have their own view supported by Java’s look and feel classes
● Pluggable Look and Feel: This feature enables the user to switch the look and feel of
Swing components without restarting an application. The Swing library supports
components look and feel that remains the same across all platforms wherever the
program runs. The Swing library provides an API that gives real flexibility in
determining the look and feel of the GUI of an application

1.2 Scope of the project :


Our project will be implement in future after making some changes and modification as make our
project at a very low level.so the modification that can be done in our projects are:-

● Adding personal details


● Adding developing options to user

Login forms are used in almost every website and Application. A login form utilizes the
credentials of a user, in order to authenticate their access. It generally consists of the typical
username or email and password. But more fields can be added to improve the site’s security.
These can be in the form of a passcode, PIN number, or a secret phrase. So indeed that a login
form is an important aspect of your site to prevent unauthorized access. A beautiful login page
can also attract a lot of visitors as well.

Login Form has the following fields:

● Email: This input field is used to take the email as input from the user.
● Password: This input field is used to take the password as input from the user.
● Show Password: This checkbox field is used to display or hide the password to the
user.
By default, it hides the password.
● Sign-in button: This button is used to authenticate and give access to the verified user.
● Forget Username/password?: This link allows the user to change their username or
password in case he/she forgets.

211521104179 VIKNESH K S
● Signup link: This link takes the user to the signup page in case they want to create a
new account.

1.3 Hardware and Software requirements :


1.3.1 Hardware requirements:
CPU : Intel core 2 Duo Q6867

Ram : 2GB

Hard Disk : 512MB

Instrument : Keyboard

Graphics : DX 11 with feature level 9.3 capabilites

1.3.2 Software requirements:


Operating system : window XP/ vista/7/8/10

Java JDK : 1.6 & above

IDE : Netbeans or Eclipse

CHAPTER 2: ALGORITHM AND FLOWCHART

2.1 Algorithm:

STEP 1: start the program

STEP 2: Create a class that uses the JFrame and ActionListener to design the login form and
perform the action

STEP 3: Create user interface components using swings and awt and add them to the panel

211521104179 VIKNESH K S
STEP 4: Override the actionPerformed() method that will call on the button click.In this method,
we will Create a class that uses the JFrame and ActionListener to design the login form and
perform the action.

STEP 5: Create a new page using JFrame and navigate the user to it if the credentials are
authentic

STEP 6: Else show an error message to the user.

STEP 7: stop the program 2.2

Flowchart :

211521104179 VIKNESH K S
CHAPTER 3: SOURCE CODE
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Exception;
class CreateLoginForm extends JFrame implements ActionListener
{
JButton b1;
JPanel newPanel; JLabel userLabel,
passLabel; final JTextField textField1,
textField2;
CreateLoginForm()
{
userLabel = new JLabel();
userLabel.setText("Username");
textField1 = new JTextField(15); passLabel
= new JLabel(); passLabel.setText("Password");
textField2 = new JPasswordField(15);
b1 = new JButton("SUBMIT");
newPanel = new JPanel(new GridLayout(3, 1));
newPanel.add(userLabel); newPanel.add(textField1);
newPanel.add(passLabel);
newPanel.add(textField2); newPanel.add(b1);
add(newPanel,
BorderLayout.CENTER);
b1.addActionListener(this);
setTitle("LOGIN FORM");
}
public void actionPerformed(ActionEvent ae)
{
String userValue = textField1.getText();
String passValue = textField2.getText();
if (userValue.equals("test1@gmail.com") && passValue.equals("test")) {
NewPage page = new NewPage();
page.setVisible(true);
System.out.println("login sucessfully");
JLabel wel_label = new JLabel("Welcome: "+userValue);
page.getContentPane().add(wel_label);
}

211521104179 VIKNESH K S
else{
System.out.println("Please enter valid username and password");
}
}
}
class LoginFormDemo
{
public static void main(String arg[])
{
try
{
CreateLoginForm form = new CreateLoginForm();
form.setSize(300,100);
form.setVisible(true);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
}
class NewPage extends JFrame
{
//constructor
NewPage()
{
setDefaultCloseOperation(javax.swing.
WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Welcome");
setSize(400, 200);
}
}

211521104179 VIKNESH K S
CHAPTER 4: Output

211521104179 VIKNESH K S
Result

Here I have designed a simple forms project.It is fully a automated system for managing the
java database. This system provides a centralized database maintenance and certain easy access
to

211521104179 VIKNESH K S

You might also like