![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]()
|
![]() ![]() ![]() ![]() |
![]() |
|
|
|
![]() |
|
Button HelpHelp is available for each task, or you can go straight to the Button source code to see a solution.Task 1Create an applet called CheckboxGroupTest.
import java.awt.*; public class CheckboxGroupTest extends java.applet.Applet { ... } Task 2Create a CheckboxGroup and 3 Checkbox objects with labels " 8 pt," "10 pt," and "12 pt."
import java.awt.*; public class CheckboxGroupTest extends java.applet.Applet { public void init() { CheckboxGroup cbg = new CheckboxGroup(); // set the 8 pt button to be on initially Checkbox cb1 = new Checkbox(" 8 pt", cbg, true); Checkbox cb2 = new Checkbox("10 pt", cbg, false); Checkbox cb3 = new Checkbox("12 pt", cbg, false); add(cb1); add(cb2); add(cb3); } } The Checkbox objects are created with a constructor that not only takes a label, but a CheckboxGroup controller object, and an initial state. |