98 Create Simple login Page in awt in Java

Code :

import java.awt.*;
class Login
{
public static void main( String args[] )
{

Frame f = new Frame();
f.setVisible(true);
f.setSize(300,300);
f.setTitle("Login Page");
f.setBackground(Color.red);
f.setLayout( new FlowLayout() );

Label l1 = new Label("Username: ");
Label l2 = new Label("Password: ");

TextField tx1 = new TextField(30);
TextField tx2 = new TextField(30);
tx2.setEchoChar('*');

Button b = new Button("Login");

f.add(l1);
f.add(tx1);

f.add(l2);
f.add(tx2);

f.add(b);
}
}




Output:




Previous
Next Post »