SlideShare a Scribd company logo
1 of 18
Download to read offline
Java!!!!!
Create a program that authenticates username and password. The program should have a clear
and submit button. If you click sumbit it will go to a new JFrame. The new Jframe contain a
menu button( that does nothing) and a logout button that exits the program.
Solution
import java.sql.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
public class Login extends javax.swing.JFrame {
/**
* Creates new form Login
*/
public Login() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jPasswordField1 = new javax.swing.JPasswordField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("Hiding Data Cloud ");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setText("User Name : ");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel3.setText("Password :");
jButton1.setText("Login");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(96, 96, 96)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(69, 69, 69)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 134,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(jPasswordField1))))))
.addContainerGap(112, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(jLabel1)
.addGap(53, 53, 53)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(27, 27, 27)
.addComponent(jButton1)
.addContainerGap(82, Short.MAX_VALUE))
);
pack();
}//
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == jButton1) {
if (jTextField1.getText().equals("") || jPasswordField1.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Please provide your details");
} else if (jTextField1.getText().equals("admin") ||
jPasswordField1.getText().equals("admin")) {
this.hide();
admin ahObj = new admin();
ahObj.setVisible(true);
} else {
try {
String getUname = jTextField1.getText();
String getPwd = jPasswordField1.getText();
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","tiger")
;
PreparedStatement psObj = con.prepareStatement("select uname,pwd from register2 where
uname = '" + getUname + "' and pwd = '" + getPwd + "'");
ResultSet rsObj = psObj.executeQuery();
if (rsObj.next()) {
JOptionPane.showMessageDialog(null, "Login Successful");
search1 usObj = new search1();
search1.jLabel7.setText(this.jTextField1.getText());
// search1 usObj = new search1();
this.hide();
usObj.setVisible(true);
}
} catch (Exception eMsg) {
System.out.println(eMsg.getMessage());
}
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JTextField jTextField1;
// End of variables declaration
}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import java.net.URLConnection;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathConstants;
import org.w3c.dom.Document;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author GALLEGA 7
*/
public class admin extends javax.swing.JFrame
{
/**
* Creates new form admin
*/
public admin() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Location Title");
jLabel2.setText("Location Address");
jLabel3.setText("Latitude");
jLabel4.setText("Longitude");
jButton1.setText("Add Location");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Cancel");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("View Locations");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Tracking");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setText("Get Values");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 95,
Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(60, 60, 60)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 92,
Short.MAX_VALUE)
.addComponent(jTextField2)
.addComponent(jTextField3)
.addComponent(jTextField4)))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addGap(39, 39, 39)
.addComponent(jButton2)))
.addContainerGap(134, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 109,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton5)
.addComponent(jButton3)))
.addGap(16, 16, 16))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(45, 45, 45)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton1))
.addGap(26, 26, 26)
.addComponent(jButton3)
.addGap(18, 18, 18)
.addComponent(jButton4)
.addGap(26, 26, 26))
);
pack();
}//
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == jButton1) {
if (jTextField1.getText().equals("") || jTextField2.getText().equals("") ||
jTextField3.getText().equals("") || jTextField4.getText().equals("") ) {
JOptionPane.showMessageDialog(null, "Please provide your details");
} else {
try {
String getTitle = jTextField1.getText();
String getAddress = jTextField2.getText();
String getLatitude = jTextField3.getText();
String getLongitude = jTextField4.getText();
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","tiger")
;
PreparedStatement psObj = con.prepareStatement("insert into location values(?,?,?,?)");
psObj.setString(1, getTitle);
psObj.setString(2, getAddress);
psObj.setString(3, getLatitude);
psObj.setString(4, getLongitude);
int status = psObj.executeUpdate();
if (status != 0) {
JOptionPane.showMessageDialog(null, "Registered Succesfully");
this.hide();
admin hObj = new admin();
hObj.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Error");
}
} catch (Exception eMsg) {
System.out.println(eMsg.getMessage());
}
}
} // TODO add your handling code here:
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
if(evt.getSource() == jButton2){
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
} // TODO add your handling code here:
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
viewlocdata ahObj = null;
try {
ahObj = new viewlocdata();
} catch (ClassNotFoundException ex) {
Logger.getLogger(admin.class.getName()).log(Level.SEVERE, null, ex);
}
ahObj.setVisible(true);
ahObj.setSize(500,400);// TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
tracking t = null;
try {
t = new tracking();
} catch (ClassNotFoundException ex) {
Logger.getLogger(admin.class.getName()).log(Level.SEVERE, null, ex);
}
t.setVisible(true);
t.setSize(500,400);
}
/**
* @param args the command line arguments
*/
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)
{
if(evt.getSource() == jButton5)
{
try
{
String getTitle = jTextField1.getText();
String getAddress = jTextField2.getText();
String postcode=getTitle+","+getAddress;
LatLng1 la=new LatLng1();
String latLongs[] = la.getLatLongPositions(postcode);
String Latitude=latLongs[0];
String Longtitude=latLongs[1];
jTextField3.setText(Latitude);
jTextField4.setText(Longtitude);
}catch(Exception ex)
{
}
} // TODO
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new admin().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
// End of variables declaration
}
import java.awt.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.table.*;
public class tracking extends JFrame
{
public tracking() throws ClassNotFoundException
{
ArrayList columnNames = new ArrayList();
ArrayList data = new ArrayList();
// Connect to an MySQL Database, run query, get result set
String url = "jdbc:oracle:thin:@localhost:1521:xe";
String userid = "system";
String password = "tiger";
String sql = "select * from tracking";
// Java SE 7 has try-with-resources
// This will ensure that the sql objects are closed when the program
// is finished with them
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection = DriverManager.getConnection( url, userid, password );
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(sql);
{
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
// Get column names
for (int i = 1; i <= columns; i++)
{
columnNames.add( md.getColumnName(i) );
}
// Get row data
while (rs.next())
{
ArrayList row = new ArrayList(columns);
for (int i = 1; i <= columns; i++)
{
row.add( rs.getObject(i) );
}
data.add( row );
}
}}
catch (SQLException e)
{
System.out.println( e.getMessage() );
}
// Create Vectors and copy over elements from ArrayLists to them
// Vector is deprecated but I am using them in this example to keep
// things simple - the best practice would be to create a custom defined
// class which inherits from the AbstractTableModel class
Vector columnNamesVector = new Vector();
Vector dataVector = new Vector();
for (int i = 0; i < data.size(); i++)
{
ArrayList subArray = (ArrayList)data.get(i);
Vector subVector = new Vector();
for (int j = 0; j < subArray.size(); j++)
{
subVector.add(subArray.get(j));
}
dataVector.add(subVector);
}
for (int i = 0; i < columnNames.size(); i++ )
columnNamesVector.add(columnNames.get(i));
// Create table with database data
JTable table = new JTable(dataVector, columnNamesVector)
{
public Class getColumnClass(int column)
{
for (int row = 0; row < getRowCount(); row++)
{
Object o = getValueAt(row, column);
if (o != null)
{
return o.getClass();
}
}
return Object.class;
}
};
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
JPanel buttonPanel = new JPanel();
getContentPane().add( buttonPanel, BorderLayout.SOUTH );
}
public static void main(String[] args) throws ClassNotFoundException
{
tracking t = new tracking();
t.setDefaultCloseOperation( EXIT_ON_CLOSE );
t.pack();
t.setSize(500,200);
t.setVisible(true);
}
}

More Related Content

Similar to Java program for username and password authentication with login and logout functionality

Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3martha leon
 
I really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfI really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfamitbagga0808
 
Grain final border one
Grain final border oneGrain final border one
Grain final border oneAshish Gupta
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfsudhirchourasia86
 
College management system.pptx
College management system.pptxCollege management system.pptx
College management system.pptxManujArora3
 
Othello.javapackage othello;import core.Game; import userInter.pdf
Othello.javapackage othello;import core.Game; import userInter.pdfOthello.javapackage othello;import core.Game; import userInter.pdf
Othello.javapackage othello;import core.Game; import userInter.pdfarccreation001
 
Net Beans Codes for Student Portal
Net Beans Codes for Student PortalNet Beans Codes for Student Portal
Net Beans Codes for Student PortalPeeyush Ranjan
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfanushkaent7
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfvenkt12345
 
correct the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfcorrect the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfdevangmittal4
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfforwardcom41
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
correct the error and add code same in the pic import jav.pdf
correct the error and add code same in the pic   import jav.pdfcorrect the error and add code same in the pic   import jav.pdf
correct the error and add code same in the pic import jav.pdfdevangmittal4
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation洪 鹏发
 

Similar to Java program for username and password authentication with login and logout functionality (20)

Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3
 
I really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfI really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdf
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
 
Grain final border one
Grain final border oneGrain final border one
Grain final border one
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
 
College management system.pptx
College management system.pptxCollege management system.pptx
College management system.pptx
 
Othello.javapackage othello;import core.Game; import userInter.pdf
Othello.javapackage othello;import core.Game; import userInter.pdfOthello.javapackage othello;import core.Game; import userInter.pdf
Othello.javapackage othello;import core.Game; import userInter.pdf
 
Net Beans Codes for Student Portal
Net Beans Codes for Student PortalNet Beans Codes for Student Portal
Net Beans Codes for Student Portal
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
 
Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just Ruby
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
 
correct the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfcorrect the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdf
 
React outbox
React outboxReact outbox
React outbox
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdf
 
New text document
New text documentNew text document
New text document
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
correct the error and add code same in the pic import jav.pdf
correct the error and add code same in the pic   import jav.pdfcorrect the error and add code same in the pic   import jav.pdf
correct the error and add code same in the pic import jav.pdf
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
Java awt
Java awtJava awt
Java awt
 

More from arvindarora20042013

I need help answering these Summarize Madison’s central arguments i.pdf
I need help answering these Summarize Madison’s central arguments i.pdfI need help answering these Summarize Madison’s central arguments i.pdf
I need help answering these Summarize Madison’s central arguments i.pdfarvindarora20042013
 
if you want to conduct business in a country like somalia what are t.pdf
if you want to conduct business in a country like somalia what are t.pdfif you want to conduct business in a country like somalia what are t.pdf
if you want to conduct business in a country like somalia what are t.pdfarvindarora20042013
 
If the U.S. population is 305.5 Million and each person was to recei.pdf
If the U.S. population is 305.5 Million and each person was to recei.pdfIf the U.S. population is 305.5 Million and each person was to recei.pdf
If the U.S. population is 305.5 Million and each person was to recei.pdfarvindarora20042013
 
If national savings remain unchanged and net capital outflow falls, .pdf
If national savings remain unchanged and net capital outflow falls, .pdfIf national savings remain unchanged and net capital outflow falls, .pdf
If national savings remain unchanged and net capital outflow falls, .pdfarvindarora20042013
 
Identify the structures labeled in the following diagrams. Identify t.pdf
Identify the structures labeled in the following diagrams. Identify t.pdfIdentify the structures labeled in the following diagrams. Identify t.pdf
Identify the structures labeled in the following diagrams. Identify t.pdfarvindarora20042013
 
Darwins 4 postulates are basic rules for when a trait is likely to .pdf
Darwins 4 postulates are basic rules for when a trait is likely to .pdfDarwins 4 postulates are basic rules for when a trait is likely to .pdf
Darwins 4 postulates are basic rules for when a trait is likely to .pdfarvindarora20042013
 
Compare the grasshopper with the crayfish. Which characteristics mak.pdf
Compare the grasshopper with the crayfish. Which characteristics mak.pdfCompare the grasshopper with the crayfish. Which characteristics mak.pdf
Compare the grasshopper with the crayfish. Which characteristics mak.pdfarvindarora20042013
 
Bonus Problem 3 Some people argued that the U.S. stock market crash o.pdf
Bonus Problem 3 Some people argued that the U.S. stock market crash o.pdfBonus Problem 3 Some people argued that the U.S. stock market crash o.pdf
Bonus Problem 3 Some people argued that the U.S. stock market crash o.pdfarvindarora20042013
 
A positive relationship exists between two variables if one variable .pdf
A positive relationship exists between two variables if one variable .pdfA positive relationship exists between two variables if one variable .pdf
A positive relationship exists between two variables if one variable .pdfarvindarora20042013
 
Asse Place the following in chronological order as fluid flow Bloo.pdf
Asse  Place the following in chronological order as fluid flow  Bloo.pdfAsse  Place the following in chronological order as fluid flow  Bloo.pdf
Asse Place the following in chronological order as fluid flow Bloo.pdfarvindarora20042013
 
Add the binary number Convert the following unsigned hexadecimal num.pdf
Add the binary number  Convert the following unsigned hexadecimal num.pdfAdd the binary number  Convert the following unsigned hexadecimal num.pdf
Add the binary number Convert the following unsigned hexadecimal num.pdfarvindarora20042013
 
A wild-type chromosome has the following segments A B C middot D E F.pdf
A wild-type chromosome has the following segments A B C middot D E F.pdfA wild-type chromosome has the following segments A B C middot D E F.pdf
A wild-type chromosome has the following segments A B C middot D E F.pdfarvindarora20042013
 
A laser range finder was used to sense the obstacles. What parameter.pdf
A laser range finder was used to sense the obstacles. What parameter.pdfA laser range finder was used to sense the obstacles. What parameter.pdf
A laser range finder was used to sense the obstacles. What parameter.pdfarvindarora20042013
 
5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdf
5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdf5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdf
5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdfarvindarora20042013
 
Which of the following types of viruses can infect both boot sectors.pdf
Which of the following types of viruses can infect both boot sectors.pdfWhich of the following types of viruses can infect both boot sectors.pdf
Which of the following types of viruses can infect both boot sectors.pdfarvindarora20042013
 
Which one is NOT typical of a ceramic material low melting point h.pdf
Which one is NOT typical of a ceramic material  low melting point  h.pdfWhich one is NOT typical of a ceramic material  low melting point  h.pdf
Which one is NOT typical of a ceramic material low melting point h.pdfarvindarora20042013
 
4. Define communication security, information security, network secu.pdf
4. Define communication security, information security, network secu.pdf4. Define communication security, information security, network secu.pdf
4. Define communication security, information security, network secu.pdfarvindarora20042013
 
What ethical concerns do anthropologists confrontSolutionRace.pdf
What ethical concerns do anthropologists confrontSolutionRace.pdfWhat ethical concerns do anthropologists confrontSolutionRace.pdf
What ethical concerns do anthropologists confrontSolutionRace.pdfarvindarora20042013
 
What is the general location of the three different types of amino a.pdf
What is the general location of the three different types of amino a.pdfWhat is the general location of the three different types of amino a.pdf
What is the general location of the three different types of amino a.pdfarvindarora20042013
 
3 Suppose V is finite-dimensional and v element of V with v is not eq.pdf
3 Suppose V is finite-dimensional and v element of V with v is not eq.pdf3 Suppose V is finite-dimensional and v element of V with v is not eq.pdf
3 Suppose V is finite-dimensional and v element of V with v is not eq.pdfarvindarora20042013
 

More from arvindarora20042013 (20)

I need help answering these Summarize Madison’s central arguments i.pdf
I need help answering these Summarize Madison’s central arguments i.pdfI need help answering these Summarize Madison’s central arguments i.pdf
I need help answering these Summarize Madison’s central arguments i.pdf
 
if you want to conduct business in a country like somalia what are t.pdf
if you want to conduct business in a country like somalia what are t.pdfif you want to conduct business in a country like somalia what are t.pdf
if you want to conduct business in a country like somalia what are t.pdf
 
If the U.S. population is 305.5 Million and each person was to recei.pdf
If the U.S. population is 305.5 Million and each person was to recei.pdfIf the U.S. population is 305.5 Million and each person was to recei.pdf
If the U.S. population is 305.5 Million and each person was to recei.pdf
 
If national savings remain unchanged and net capital outflow falls, .pdf
If national savings remain unchanged and net capital outflow falls, .pdfIf national savings remain unchanged and net capital outflow falls, .pdf
If national savings remain unchanged and net capital outflow falls, .pdf
 
Identify the structures labeled in the following diagrams. Identify t.pdf
Identify the structures labeled in the following diagrams. Identify t.pdfIdentify the structures labeled in the following diagrams. Identify t.pdf
Identify the structures labeled in the following diagrams. Identify t.pdf
 
Darwins 4 postulates are basic rules for when a trait is likely to .pdf
Darwins 4 postulates are basic rules for when a trait is likely to .pdfDarwins 4 postulates are basic rules for when a trait is likely to .pdf
Darwins 4 postulates are basic rules for when a trait is likely to .pdf
 
Compare the grasshopper with the crayfish. Which characteristics mak.pdf
Compare the grasshopper with the crayfish. Which characteristics mak.pdfCompare the grasshopper with the crayfish. Which characteristics mak.pdf
Compare the grasshopper with the crayfish. Which characteristics mak.pdf
 
Bonus Problem 3 Some people argued that the U.S. stock market crash o.pdf
Bonus Problem 3 Some people argued that the U.S. stock market crash o.pdfBonus Problem 3 Some people argued that the U.S. stock market crash o.pdf
Bonus Problem 3 Some people argued that the U.S. stock market crash o.pdf
 
A positive relationship exists between two variables if one variable .pdf
A positive relationship exists between two variables if one variable .pdfA positive relationship exists between two variables if one variable .pdf
A positive relationship exists between two variables if one variable .pdf
 
Asse Place the following in chronological order as fluid flow Bloo.pdf
Asse  Place the following in chronological order as fluid flow  Bloo.pdfAsse  Place the following in chronological order as fluid flow  Bloo.pdf
Asse Place the following in chronological order as fluid flow Bloo.pdf
 
Add the binary number Convert the following unsigned hexadecimal num.pdf
Add the binary number  Convert the following unsigned hexadecimal num.pdfAdd the binary number  Convert the following unsigned hexadecimal num.pdf
Add the binary number Convert the following unsigned hexadecimal num.pdf
 
A wild-type chromosome has the following segments A B C middot D E F.pdf
A wild-type chromosome has the following segments A B C middot D E F.pdfA wild-type chromosome has the following segments A B C middot D E F.pdf
A wild-type chromosome has the following segments A B C middot D E F.pdf
 
A laser range finder was used to sense the obstacles. What parameter.pdf
A laser range finder was used to sense the obstacles. What parameter.pdfA laser range finder was used to sense the obstacles. What parameter.pdf
A laser range finder was used to sense the obstacles. What parameter.pdf
 
5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdf
5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdf5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdf
5. Evaluate the following integral (t 2)cos Tut4)dt SolutionTh.pdf
 
Which of the following types of viruses can infect both boot sectors.pdf
Which of the following types of viruses can infect both boot sectors.pdfWhich of the following types of viruses can infect both boot sectors.pdf
Which of the following types of viruses can infect both boot sectors.pdf
 
Which one is NOT typical of a ceramic material low melting point h.pdf
Which one is NOT typical of a ceramic material  low melting point  h.pdfWhich one is NOT typical of a ceramic material  low melting point  h.pdf
Which one is NOT typical of a ceramic material low melting point h.pdf
 
4. Define communication security, information security, network secu.pdf
4. Define communication security, information security, network secu.pdf4. Define communication security, information security, network secu.pdf
4. Define communication security, information security, network secu.pdf
 
What ethical concerns do anthropologists confrontSolutionRace.pdf
What ethical concerns do anthropologists confrontSolutionRace.pdfWhat ethical concerns do anthropologists confrontSolutionRace.pdf
What ethical concerns do anthropologists confrontSolutionRace.pdf
 
What is the general location of the three different types of amino a.pdf
What is the general location of the three different types of amino a.pdfWhat is the general location of the three different types of amino a.pdf
What is the general location of the three different types of amino a.pdf
 
3 Suppose V is finite-dimensional and v element of V with v is not eq.pdf
3 Suppose V is finite-dimensional and v element of V with v is not eq.pdf3 Suppose V is finite-dimensional and v element of V with v is not eq.pdf
3 Suppose V is finite-dimensional and v element of V with v is not eq.pdf
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 

Recently uploaded (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 

Java program for username and password authentication with login and logout functionality

  • 1. Java!!!!! Create a program that authenticates username and password. The program should have a clear and submit button. If you click sumbit it will go to a new JFrame. The new Jframe contain a menu button( that does nothing) and a logout button that exits the program. Solution import java.sql.*; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Administrator */ public class Login extends javax.swing.JFrame { /** * Creates new form Login */ public Login() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // private void initComponents() {
  • 2. jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jPasswordField1 = new javax.swing.JPasswordField(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setText("Hiding Data Cloud "); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel2.setText("User Name : "); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel3.setText("Password :"); jButton1.setText("Login"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(96, 96, 96) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(69, 69, 69) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))
  • 3. .addGroup(layout.createSequentialGroup() .addComponent(jLabel3) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1) .addComponent(jPasswordField1)))))) .addContainerGap(112, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(35, 35, 35) .addComponent(jLabel1) .addGap(53, 53, 53) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27) .addComponent(jButton1) .addContainerGap(82, Short.MAX_VALUE)) ); pack(); }// private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { if (evt.getSource() == jButton1) { if (jTextField1.getText().equals("") || jPasswordField1.getText().equals("")) { JOptionPane.showMessageDialog(null, "Please provide your details"); } else if (jTextField1.getText().equals("admin") || jPasswordField1.getText().equals("admin")) { this.hide();
  • 4. admin ahObj = new admin(); ahObj.setVisible(true); } else { try { String getUname = jTextField1.getText(); String getPwd = jPasswordField1.getText(); Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","tiger") ; PreparedStatement psObj = con.prepareStatement("select uname,pwd from register2 where uname = '" + getUname + "' and pwd = '" + getPwd + "'"); ResultSet rsObj = psObj.executeQuery(); if (rsObj.next()) { JOptionPane.showMessageDialog(null, "Login Successful"); search1 usObj = new search1(); search1.jLabel7.setText(this.jTextField1.getText()); // search1 usObj = new search1(); this.hide(); usObj.setVisible(true); } } catch (Exception eMsg) { System.out.println(eMsg.getMessage()); } } } }
  • 5. /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ // /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE , null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE , null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE , null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE , null, ex); } // /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Login().setVisible(true); }
  • 6. }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPasswordField jPasswordField1; private javax.swing.JTextField jTextField1; // End of variables declaration } import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import java.net.URLConnection; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.io.InputStreamReader; import java.io.BufferedReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathConstants; import org.w3c.dom.Document; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */
  • 7. /** * * @author GALLEGA 7 */ public class admin extends javax.swing.JFrame { /** * Creates new form admin */ public admin() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // private void initComponents() { jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("Location Title"); jLabel2.setText("Location Address");
  • 8. jLabel3.setText("Latitude"); jLabel4.setText("Longitude"); jButton1.setText("Add Location"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Cancel"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("View Locations"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton4.setText("Tracking"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton5.setText("Get Values"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  • 9. .addGroup(layout.createSequentialGroup() .addGap(40, 40, 40) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(60, 60, 60) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) .addComponent(jTextField2) .addComponent(jTextField3) .addComponent(jTextField4))) .addGroup(layout.createSequentialGroup() .addComponent(jButton1) .addGap(39, 39, 39) .addComponent(jButton2))) .addContainerGap(134, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton5) .addComponent(jButton3))) .addGap(16, 16, 16)) ); layout.setVerticalGroup(
  • 10. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(45, 45, 45) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(23, 23, 23) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(2, 2, 2) .addComponent(jButton5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton1)) .addGap(26, 26, 26) .addComponent(jButton3) .addGap(18, 18, 18) .addComponent(jButton4) .addGap(26, 26, 26)) ); pack();
  • 11. }// private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { if (evt.getSource() == jButton1) { if (jTextField1.getText().equals("") || jTextField2.getText().equals("") || jTextField3.getText().equals("") || jTextField4.getText().equals("") ) { JOptionPane.showMessageDialog(null, "Please provide your details"); } else { try { String getTitle = jTextField1.getText(); String getAddress = jTextField2.getText(); String getLatitude = jTextField3.getText(); String getLongitude = jTextField4.getText(); Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","tiger") ; PreparedStatement psObj = con.prepareStatement("insert into location values(?,?,?,?)"); psObj.setString(1, getTitle); psObj.setString(2, getAddress); psObj.setString(3, getLatitude); psObj.setString(4, getLongitude); int status = psObj.executeUpdate(); if (status != 0) { JOptionPane.showMessageDialog(null, "Registered Succesfully"); this.hide(); admin hObj = new admin(); hObj.setVisible(true); } else { JOptionPane.showMessageDialog(null, "Error"); } } catch (Exception eMsg) { System.out.println(eMsg.getMessage());
  • 12. } } } // TODO add your handling code here: } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource() == jButton2){ jTextField1.setText(""); jTextField2.setText(""); jTextField3.setText(""); jTextField4.setText(""); } // TODO add your handling code here: } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { viewlocdata ahObj = null; try { ahObj = new viewlocdata(); } catch (ClassNotFoundException ex) { Logger.getLogger(admin.class.getName()).log(Level.SEVERE, null, ex); } ahObj.setVisible(true); ahObj.setSize(500,400);// TODO add your handling code here: } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { tracking t = null; try { t = new tracking(); } catch (ClassNotFoundException ex) { Logger.getLogger(admin.class.getName()).log(Level.SEVERE, null, ex); } t.setVisible(true); t.setSize(500,400);
  • 13. } /** * @param args the command line arguments */ private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource() == jButton5) { try { String getTitle = jTextField1.getText(); String getAddress = jTextField2.getText(); String postcode=getTitle+","+getAddress; LatLng1 la=new LatLng1(); String latLongs[] = la.getLatLongPositions(postcode); String Latitude=latLongs[0]; String Longtitude=latLongs[1]; jTextField3.setText(Latitude); jTextField4.setText(Longtitude); }catch(Exception ex) {
  • 14. } } // TODO } public static void main(String args[]) { /* Set the Nimbus look and feel */ // /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE , null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE , null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE
  • 15. , null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(admin.class.getName()).log(java.util.logging.Level.SEVERE , null, ex); } // /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new admin().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration } import java.awt.*; import java.sql.*; import java.util.*; import javax.swing.*; import static javax.swing.JFrame.EXIT_ON_CLOSE;
  • 16. import javax.swing.table.*; public class tracking extends JFrame { public tracking() throws ClassNotFoundException { ArrayList columnNames = new ArrayList(); ArrayList data = new ArrayList(); // Connect to an MySQL Database, run query, get result set String url = "jdbc:oracle:thin:@localhost:1521:xe"; String userid = "system"; String password = "tiger"; String sql = "select * from tracking"; // Java SE 7 has try-with-resources // This will ensure that the sql objects are closed when the program // is finished with them try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection connection = DriverManager.getConnection( url, userid, password ); Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql); { ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); // Get column names for (int i = 1; i <= columns; i++) { columnNames.add( md.getColumnName(i) ); } // Get row data while (rs.next()) { ArrayList row = new ArrayList(columns); for (int i = 1; i <= columns; i++) { row.add( rs.getObject(i) );
  • 17. } data.add( row ); } }} catch (SQLException e) { System.out.println( e.getMessage() ); } // Create Vectors and copy over elements from ArrayLists to them // Vector is deprecated but I am using them in this example to keep // things simple - the best practice would be to create a custom defined // class which inherits from the AbstractTableModel class Vector columnNamesVector = new Vector(); Vector dataVector = new Vector(); for (int i = 0; i < data.size(); i++) { ArrayList subArray = (ArrayList)data.get(i); Vector subVector = new Vector(); for (int j = 0; j < subArray.size(); j++) { subVector.add(subArray.get(j)); } dataVector.add(subVector); } for (int i = 0; i < columnNames.size(); i++ ) columnNamesVector.add(columnNames.get(i)); // Create table with database data JTable table = new JTable(dataVector, columnNamesVector) { public Class getColumnClass(int column) { for (int row = 0; row < getRowCount(); row++) { Object o = getValueAt(row, column);
  • 18. if (o != null) { return o.getClass(); } } return Object.class; } }; JScrollPane scrollPane = new JScrollPane( table ); getContentPane().add( scrollPane ); JPanel buttonPanel = new JPanel(); getContentPane().add( buttonPanel, BorderLayout.SOUTH ); } public static void main(String[] args) throws ClassNotFoundException { tracking t = new tracking(); t.setDefaultCloseOperation( EXIT_ON_CLOSE ); t.pack(); t.setSize(500,200); t.setVisible(true); } }