Data Base
Data Base
import java.awt.Font;
import java.sql.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import javax.swing.*;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
JFrame jf;
JTextField t1,t2;
JButton login;
JLabel l1,l2;
public adminlogin() {
l1=new JLabel("Username");
l1.setBounds(50,100,200,30);
l2=new JLabel("Password");
l2.setBounds(50,200,100,50);
t1=new JTextField();
t1.setBounds(110,100,200,30);
t2=new JTextField();
t2.setBounds(110,200,200,30);
jf.add(l1);
jf.add(l2);
jf.add(t1);
jf.add(t2);
jf.setSize(400,400);
jf.setLayout(null);
jf.setVisible(true);
login=new JButton("Login");
login.setBounds(150,250,95,30);
login.addActionListener(this);
jf.add(login);
jf.setSize(400,400);
jf.setLayout(null);
jf.setVisible(true);
String userValue=t1.getText();
String passValue=t2.getText();
System.out.println(userValue);
System.out.println(passValue);
while(rs.next()) {
System.out.println(rs.getString("password"));
if(rs.getString("username").equals(userValue) &&
rs.getString("password").equals(passValue))
jf.setVisible(false);
else {
catch(Exception ee)
ee.printStackTrace();
//TextField tf1,tf2;
}
public static void main(String[] args) {
new adminlogin();