Checkbox group:
A class java.awt.CheckboxGroup can be used to control the behaviour of a group of checkboxes. Like a group just permit a single selection. By Clicking on a different check box in a group automatically unchecks the previous check box. Like as mutually exclusive check boxes are frequently called radio buttons.
The following methods return the currently chosen check box and set a particular check box as the current selection in a CheckboxGroup:
CheckboxGroup getSelectedCheckbox( )
void setSelectedChekbox(Checkbox box)
CheckboxGroup object does not have a graphical representation, and it's not a subclass of part. A CheckboxGroup is only a class to implement mutual exclusion between a set of checkboxes.
// Illustration of Radio buttons
import java. awt.*;
import java.applet.*;
public class CheckboxGroupApplet extends Applet
{
public void init ( )
{
CheckboxGroup pizzaGroup = new CheckboxGroup ( );
CheckboxGroup cbLarge = new CheckboxGroup("Large Pan Pizza", pizzaGroup, false);
CheckboxGroup bMedium=new CheckboxGroup("MediumPan Pizza",true,pizzaGroup);
CheckboxGroup cbSmall = new CheckboxGroup("Small Pan Pizza", false);
CbSmall.setCheckboxGroup(pizzaGroup);
add(cbLarge);
add(cbMedium);
add(cbSmall);
}
}