Home Java Example Java Awt Checkbox
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Checkbox

Advertisement
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.

 

Advertisement

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: March 13, 2008

Related Tutorials

Ask Questions?    Discuss: Checkbox   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Bulson
July 11, 2011
steps to get job in APPLE company

i am in B.tech 3rd year,what step should i take after my B.tech and to become a succesful engineer??????????????????
Jafar
July 11, 2011
AWt check Box

An applet to demonstrate the use of Check boc Class: import java.awt.*; import java.applet.*; public class CheckboxExample extands Applet { Checkbox C1; Checkbox C2; public void int() { C1= new Checkbox("First check bos", true); C2= new Checkbox("First check bos", false); add(C1); add(C2); public viod paint(Graphic g) { boolean checked= C1.getstate() if() { g.drawString("First Box Selected", 20,220); else g.drawString("Second Checked box is Selected", 20,20); } }
DMCA.com