Login page in awt applet Java

Creating Login page in awt applet is easy.

Here we are not using any layout.

Login page contains two label, one textfield , one password field and two buttons.

Steps by step process to develop this program is as below

  1. Declare Label, JTextField, JPasswordField and Button
  2. Inside init() create object for JLabel, JTextField and JPasswordField and Button
  3. setBounds() to show elements in specific position.
  4. set Container layout to null setLayout(null);
  5. add all elements to container using add()
  6. set size of container setSize(400, 300);
  7. addActionListener() to login and reset button
  8. override actionPerformed() for login and reset
  9. on click on login button if username is Bond007 and password in James007 then show message Dialog Successfully Login
  10. if username and password is incorrect then show message Dialog Opps username/ password is incorrect
  11. on click on reset button reset the values of username and password field

Login page in awt applet Example

Elements are placed in specific position using setBound().

Buttons click events are bind using ActionListener and handled by actionPerformed.

We handled events like below.

You can handle actionPerformed() separately for that you have to implement ActionListener in your class.

You can run and check Program output

Login page in awt applet
Fig: Login page in awt applet failure
Login page in awt applet success
Fig: Login page in awt applet success

Hope you Got this.

Read More

Login form in Java Swing and MySql Database with source code

Registration Form in Java Swing with MySql Database

JTable in Java Swing with Examples
JTable Pagination in Java JDBC and MySQL Database