User Registration and Login without Database using Java AWT

User Registration and Login without Database using Java AWT

-------------------------------------------------------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Testing extends Frame implements ActionListener
{
    Button b1,b2,b3;
    TextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12;
    Label l1,l2,l3,l4;
    String name,email,ph,password,add,email1,password1;
    Testing()
    {
           
        l1=new Label("Enter Details");
        add(l1);
        l1.setBounds(90,60,130,35);
       
              t1=new TextField();
            add(t1);
            t1.setBounds(60,100,130,35);
           
           
            t2=new TextField();
            add(t2);
            t2.setBounds(60,140,130,35);
           
             t3=new TextField();
            add(t3);
            t3.setBounds(60,180,130,35);
       
           
           
            t4=new TextField();
            add(t4);
            t4.setBounds(60,215,130,35);
            t4.setEchoChar('*');
           
             t5=new TextField();
            add(t5);
            t5.setBounds(60,250,130,35);
           
           
             l2=new Label("Information");
            add(l2);
            l2.setBounds(250,60,130,35);
           
              t6=new TextField();
            add(t6);
            t6.setBounds(220,100,130,35);
            t6.setEditable(false);
           
            t7=new TextField();
            add(t7);
            t7.setBounds(220,140,130,35);
            t7.setEditable(false);
             t8=new TextField();
            add(t8);
            t8.setBounds(220,180,130,35);
         t8.setEditable(false);
           
           
            t9=new TextField();
            add(t9);
            t9.setBounds(220,215,130,35);
            t9.setEditable(false);
           
            t10=new TextField();
            add(t10);
            t10.setBounds(220,250,130,35);
            t10.setEditable(false);
           
           
            b1=new Button("Register");
            add(b1);
            b1.setBounds(70,290,110,35);
            b1.addActionListener(this);
         
            b2=new Button("Clear");
            add(b2);
            b2.setBounds(230,290,110,35);
            b2.addActionListener(this);
         
             
               l2=new Label("Login");
            add(l2);
            l2.setBounds(380,60,130,35);
             
                t11=new TextField();
            add(t11);
            t11.setBounds(370,100,130,35);
         
           
             t12=new TextField();
            add(t12);
            t12.setBounds(370,145,130,35);
              t12.setEchoChar('*');
             
              b3=new Button("Login");
            add(b3);
            b3.setBounds(380,185,100,35);
            b3.addActionListener(this);
           
             
               l4=new Label();
            add(l4);
            l4.setBounds(380,255,100,35);
            l4.setForeground(Color.red);
           
              setLayout(null);
           
    }
   
    public void actionPerformed(ActionEvent e)
    {
        if(e.getSource()==b1)
        {
            name=t1.getText();
            email=t2.getText();
            ph=t3.getText();
            password=t4.getText();
            add=t5.getText();
           
       
        }
        else if(e.getSource()==b3)
        {
            email1=t11.getText();
            password1=t12.getText();
           
            if(email.compareTo(email1)==0&&password.compareTo(password1)==0)
            {
                  t6.setText(name);
                  t7.setText( email);
                  t8.setText(ph);
                  t9.setText( password);
                  t10.setText( add);
            }
            else
            {
                l4.setText("Invalid Details");
            }
         
        }
        else
        {
             t1.setText("");
          t2.setText( "");
          t3.setText("");
          t4.setText( "");
          t5.setText( "");
         
           t6.setText("");
          t7.setText( "");
          t8.setText("");
          t9.setText( "");
          t10.setText( "");
        }
    }
   
    public static void main(String[] args)
    {
            Testing obj=new Testing();
            obj.setSize(600,400);
            obj.setVisible(true); 
         
    }
}

0 Comments