Home Java Example Java Awt Checkbox



Checkbox
Posted on: March 13, 2008 at 12:00 AM
A checkbox is again a label which is displayed as a pushbutton as shown in the example below. This pushbutton can either be checked or unchecked. Therefore, the state of the checkbox is either true or false. However, the initial state is false which is th

Checkbox

     

A checkbox is again a label which is displayed as a pushbutton as shown in the example below. This pushbutton can either be checked or unchecked. Therefore, the state of the checkbox is either true or false. However, the initial state is false which is the default one. The example below shows the checkbox whose state gets toggled <<<<<<< checkbox.shtml on clicking.

 

 

======= on clicking.

>>>>>>> 1.2
import java.awt.*; 
import java.applet.Applet; 
 
public class MyCheckbox extends Applet { 
  public void init() { 
  Checkbox c = new Checkbox("Choose this option"); 
  add(c); 
  


Here is the Output:

C:\newprgrm>javac MyCheckbox.java

C:\newprgrm>appletviewer MyCheckbox.html

 

Download this example.

 

Related Tags for Checkbox:
cbuttoncheckboxdisplaylabeldefaultstatethisaicheckshowforexampleuncpushboxtoiniexamrefsheitlscaninitsplulfaultinasstamplaytrcaispcheckedtrueuncheckedfalsehowxawhichxampsspatkismplstatttssthshobelostababeldispeitherefaultgakbinitialpleplono


More Tutorials from this section

Ask Questions?    Discuss: Checkbox   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.