Program:
~~~~~~
import javax.swing.*;
import java.awt.*;
class jpf extends JFrame
{
Container con;
JLabel l1,l2,l3;
JTextField t1;
JPasswordField p1; //Class to create Password Field
JButton b1,b2;
jpf()
{
con=getContentPane();
con.setLayout(null);
l1=new JLabel("Login Page");
l2=new JLabel("User Name");
t1=new JTextField();
l3=new JLabel("Password");
p1=new JPasswordField();
b1=new JButton("Submit");
b2=new JButton("reset");
l1.setBounds(150,50,90,30);
l2.setBounds(90,120,90,30);
t1.setBounds(180,120,90,30);
l3.setBounds(90,180,90,30);
p1.setBounds(180,180,90,30);
b1.setBounds(90,220,90,30);
b2.setBounds(180,220,90,30);
con.add(l1);
con.add(l2);
con.add(t1);
con.add(l3);
con.add(p1);
con.add(b1);
con.add(b2);
}
public static void main(String args[]) throws Exception
{
jpf obj=new jpf();
obj.setVisible(true);
obj.setSize(400,400);
obj.setTitle("this is my Frame");
}
}
OUTPUT:
~~~~~~~~
~~~~~~
import javax.swing.*;
import java.awt.*;
class jpf extends JFrame
{
Container con;
JLabel l1,l2,l3;
JTextField t1;
JPasswordField p1; //Class to create Password Field
JButton b1,b2;
jpf()
{
con=getContentPane();
con.setLayout(null);
l1=new JLabel("Login Page");
l2=new JLabel("User Name");
t1=new JTextField();
l3=new JLabel("Password");
p1=new JPasswordField();
b1=new JButton("Submit");
b2=new JButton("reset");
l1.setBounds(150,50,90,30);
l2.setBounds(90,120,90,30);
t1.setBounds(180,120,90,30);
l3.setBounds(90,180,90,30);
p1.setBounds(180,180,90,30);
b1.setBounds(90,220,90,30);
b2.setBounds(180,220,90,30);
con.add(l1);
con.add(l2);
con.add(t1);
con.add(l3);
con.add(p1);
con.add(b1);
con.add(b2);
}
public static void main(String args[]) throws Exception
{
jpf obj=new jpf();
obj.setVisible(true);
obj.setSize(400,400);
obj.setTitle("this is my Frame");
}
}
OUTPUT:
~~~~~~~~
No comments:
Post a Comment