OneCompiler

SJ9923J9

120
  1. Write a java program to implement packages.

import java.awt.;
import java.awt.event.
;
class MyLoginWindow extends Frame
{
public static void main(String args[])
{
Frame f=new Frame();
f.setLayout(new FlowLayout());
f.setVisible(true);
f.setSize(400,400);
f.setTitle("my login window");
Label n=new Label("Name:"",Label.CENTER);
Label p=new Label("password:"",Label.CENTER);
TextField t1=new TextField(40);
TextField t2=new TextField(40);
t2.setEchoChar('#');
Button b1=new Button("submit");
Button b2=new Button("cancel");
f.add(n);
f.add(t1);
f.add(p);
f.add(t2);
f.add(b1);
f.add(b2);
n.setBounds(70,90,90,60);
p.setBounds(70,130,90,60);
t1.setBounds(200,100,90,20);
t2.setBounds(200,140,90,20);
b1.setBounds(100,260,70,40);
b2.setBounds(180,260,70,40);
}
}