Wednesday, August 21, 2013

PROGRAM FOR CHECK BOX

import javax.swing.*;
import java.awt.*;
class check extends JFrame
{
Container con;
JCheckBox c1,c2;
     check( )
{
  con=getContentPane();
         con.setLayout(null);
          JLabel jl=new JLabel("HOBBIES");
         jl.setBounds(100,80,90,30);
c1=new JCheckBox("reading")
        c2=new JCheckBox("writing");
        c1.setBounds(100,100,90,30);
c2.setBounds(100,150,90,30);
        con.add(c1);
  con.add(c2);
  con.add(jl);

}
   public static void main(String args[]) throws Exception
{
    check obj=new check();
     obj.setVisible(true);
    obj.setSize(400,400);
    obj.setTitle("this is my Frame");

}
}

OUTPUT:
`````````````

NOTE:
It uses main method so it supports only the standalone application. 

No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips