1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
/* Create Checked Checkbox Example This java example shows how to create a checked Checkbox using AWT Checkbox class. */ import java.applet.Applet; import java.awt.Checkbox; /* <applet code="CreateCheckBox" width=200 height=200> </applet> */ public class CreateCheckedCheckBox extends Applet{ public void init(){ //crete checkboxes Checkbox checkBox1 = new Checkbox("My Checkbox 1"); /* * To create a checked checkbox, use * Checkbox(String label, boolean on) * Constructor. */ Checkbox checkbox2 = new Checkbox("My Checkbox 2", true); //add checkboxes using add method add(checkBox1); add(checkbox2); } } |
Example Output
Add Comment