|
CHECKBOXES
A checkbox is a small
box that when clicked a check mark will appear within it. If clicked
again, it will remove the check mark. By default a checkbox is
always off, however it can be set to the “on” state.
We can do this when we initialize the checkbox and specify that
it is true, meaning it is on.
Checkbox box1 = new checkbox(“ON”,
true);
The label of the
checkbox is passed as an argument.
Checkbox groups are often referred to as radio buttons. With radio
buttons, only one button can be selected at a time. To create
a checkbox group or radio buttons, a CheckboxGroup object needs
to be created.
CheckboxGroup answer =
new CheckboxGroup( );
To create a box from the group answer:
Checkbox sayyes = new
Checkbox(“YES”, answer);
For all checkboxes, when it is clicked an item event occurs. There
needs to be and ItemListenter from the listener class, that is
attached to the event.
|
|