Escolar Documentos
Profissional Documentos
Cultura Documentos
Login Application.
It is an E-Business Application.
1.3 Objective:
This project covers the login module of an E business application.this could be applied on
various applications.
2. SYSTEM SPECIFICATIONS:
Front End Software is software used to design the interface for an application
through which a user can interact with system.
We used Net beans IDE 5.5 version for designing interface for our application.
1
Back End software is the software which is used to design database for an
application.
DATABASE DESCRIPTION:
The Student table in MySQL database (namely demo) has following structure
address varchar(50)
Sample Table:
2
E7 Russel smith Hfghfg India
Screen shots
Database:
3
4
Project Screen 1:
Project Screen 2
5
Project Screen 3
When user clicks on Retrieve button then a dorm displays the record of all employees
6
Coding:
import java.awt.*;
7
import javax.swing.*;
import java.util.*;
import java.awt.event.*;
import java.sql.*;
JLabel l_name,l_pass;
JTextField t_name;
JPasswordField t_pass;
JButton button;
Container c;
handler handle;
database db;
login()
super("Login form");
c=getContentPane();
c.setLayout(new FlowLayout());
db=new database();
l_name=new JLabel("Username");
l_pass=new JLabel("Password");
8
t_name=new JTextField(10);
t_pass=new JPasswordField(10);
button=new JButton("Login");
button.addActionListener(handle);
c.add(l_name);
c.add(t_name);
c.add(l_pass);
c.add(t_pass);
.add(button);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400,400);
if(ae.getSource()==button)
9
char[] temp_pwd=t_pass.getPassword();
String pwd=null;
pwd=String.copyValueOf(temp_pwd);
System.out.println("Username,Pwd:"+t_name.getText()+",
"+pwd);
if(db.checkLogin(t_name.getText(), pwd))
JOptionPane.INFORMATION_MESSAGE);
else
JOptionPane.showMessageDialog(null, "Login
failed!","Failed!!",JOptionPane.ERROR_MESSAGE);
class database
10
final Vector columnNames = new Vector();
Connection con;
PreparedStatement pst;
ResultSet rs;
database()
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306
login","root","root");
catch (Exception e)
System.out.println(e);
11
try
pst.setString(1, uname);
pst.setString(2, pwd);
rs=pst.executeQuery();
ResultSetMetaData md = rs.getMetaData();
columnNames.addElement( md.getColumnName(i) );
while (rs.next())
row.addElement( rs.getObject(i) );
data.addElement( row );
12
tab.add( scrollPane );
tab.setVisible(true);
tab.setSize(500,500);
return true;
catch (Exception e)
return false;
13