Checkbox and Checkbox Group:
The Checkbox class implements a GUI checkbox along with a textual label. A Checkbox object could be in one of the two states:
• true: meaning which it is checked
• false: meaning which it is unchecked
The Checkbox class has the given constructors
Checkbox( )
Checkbox(String label)
Checkbox(Stiring label, boolean state)
Checkbox(String label, boolean state, CheckboxGroup group)
The initial state is unchecked if the state is not explicitly specified in the suitable constructor. A state of the checkbox can be toggled through clicking on the checkbox.
A checkbox can be incorporated in a CheckboxGroup to implement radio buttons. Unless the CheckboxGroup is specified in the suitable constructor, the checkbox is not element of any CheckboxGroup.
// Illustrating Checkbox
import java.awt.*;
import java.applet.*;
public class CheckboxApplet extends Applet
{
public void init ( )
{
Checkbox option = new Checkbox ("Large pan Pizza");
option.setState(true);
add(option);
}
}
The following methods