Adding Checkboxes
Adding Checkboxes
- Checkboxes
- are either on or off.
- The mouse click on the checkbox toggles its value.
- Construction
- private Checkbox aCheckbox;
aCheckbox = new Checkbox("Sample Label");
- aCheckbox = new Checkbox("Sample Label", null, true);
- The second parameter places a checkbox into a CheckboxGroup.
- The third parameter is the initial setting.
- public void init( ) {
Checkbox kim = new Checkbox("Kim");
Checkbox park= new Checkbox("Park");
add(kim); // Add them to the applet panel.
add(park);
}
- Other Methods
- getState( ), setState(boolean), getLabel( ), setLabel(string)
Notes: