Wednesday, September 18, 2013

SWING PROGRAM FOR PERSONAL DETAILS

PROGRAM:
~~~~~~~~~
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class a extends JFrame
{
JLabel l1,l2,l3,l4,l5;
JTextField t1,t2;
JCheckBox ch1,ch2;
JComboBox c;
List li;
JButton b1;
a()
{
l1=new JLabel("enter your name");
l2=new JLabel("enter your address");
l3=new JLabel("Hobby");
l4=new JLabel("Qualification");
l5=new JLabel("Nationality");
t1=new JTextField(20);
t2=new JTextField(20);
ch1=new JCheckBox("cricket");
ch2=new JCheckBox("football");
c=new JComboBox();
c.addItem("MCA");
c.addItem("BCA");
c.addItem("MTech");
c.addItem("Btech");
li=new List(1);
li.addItem("indian");
li.addItem("american");
li.addItem("japanese");
li.addItem("chinese");
b1=new JButton("submit");
setLayout(new FlowLayout());
add(l1);add(t1);
add(l2);add(t2);
add(l3);add(ch1);add(ch2);
add(l4);add(c);
add(l5);add(li);
add(b1);
}
public static void main(String h[])
{
a ob=new a();
ob.setSize(400,400);
ob.setTitle("MY FIRST FRAME");
ob.setVisible(true);
}
}

OUTPUT:
~~~~~~~


No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips