Home Java Example Java Awt How to create CheckBox On frame

Related Tutorials


 
 

Share on Google+Share on Google+

How to create CheckBox On frame

Advertisement
This is very simple java program. In this section, you will learn how to create CheckBox on the frame.

How to create CheckBox On frame

     

This is very simple java program. In this section, you will learn how to create CheckBox on the frame. In the Java AWT, top-level windows are represented by the CheckBox class. This program provides you complete illustration with the full description. If you are fresher in java awt programming then you can learn in very efficient manner.

In this section, you will see how to create and show the checkbox component on the frame. Here, explanation for the procedure of inserting checkboxes on the Java AWT Frame. You can understand very easily by trying the given complete code of the program.

Program Description:

There is class named CheckBox is used in the program for creating a checkbox component. This class is explained as follows:

CheckBox(): This is the constructors for CheckBox class used for creating checkbox. The constructor is taking here a String type parameter that is the label of checkbox.

Here is the code of this program:

import java.awt.*;
import java.awt.event.*;
public class CheckBoxDemo{
  public static void main(String[] args){
  Frame frame= new Frame("Checkbox");
  Checkbox check=new Checkbox("Welcome");
  Checkbox check1=new Checkbox("Roseindia");
  frame.add(check);
  frame.add(check1);
  frame.setLayout(new FlowLayout());
  frame.setSize(300,200);
  frame.setVisible(true);
  frame.addWindowListener(new WindowAdapter(){
  public void windowClosing(WindowEvent e){
  System.exit(0);
  }
  });
  }
}

Output for the above program:

  

Download this example.

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 17, 2007

Related Tutorials

Discuss: How to create CheckBox On frame  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:3
deepak kumar sana
March 19, 2013
java programming lanuage

easy to handle this type of program but i want to combine student detail forms how???????????
arbind sahu
January 5, 2012
checkbox frame

ur solution is having some mistake the checkbox class should not have a public class.........
Bilawal
August 22, 2013
java2

your web is good and i have goten more from your website
DMCA.com