The Checkbox is a Component that provides a true or false toggle switch for user input.
public class java.awt.Checkbox extends java.awt.Component implements java.awt.ItemSelectable { // Constructors public Checkbox(); public Checkbox (String label); public Checkbox (String label, boolean state); public Checkbox (String label, boolean state, CheckboxGroup group); public Checkbox (String label, CheckboxGroup group, boolean state); // Instance Methods public void addItemListener (ItemListener l); public void addNotify(); public CheckboxGroup getCheckboxGroup(); public String getLabel(); public Object[] getSelectedObjects(); public boolean getState(); public void removeItemListener (ItemListener l); public void setCheckboxGroup (CheckboxGroup group); public synchronized void setLabel (String label); public void setState (boolean state); // Protected Instance Methods protected String paramString(); protected void processEvent (AWTEvent e); protected void processItemEvent (ItemEvent e); }
Constructs a Checkbox object with no label that is initially false.
Text to display with the Checkbox.
Constructs a Checkbox object with the given label that is initially false.
Text to display with the Checkbox.
Intial value of the Checkbox.
Constructs a Checkbox with the given label, initialized to the given state.
Text to display with the Checkbox.
Intial value of the Checkbox.
The CheckboxGroup this Checkbox should belong to.
Constructs a Checkbox with the given label, initialized to the given state and belonging to group.
Text to display with the Checkbox.
The CheckboxGroup this Checkbox should belong to.
Intial value of the Checkbox.
Constructs a Checkbox object with the given settings.
The listener to be added.
ItemSelectable.addItemListener(ItemListener l)
Adds a listener for the ItemEvent objects this Checkbox generates.
Component.addNotify()
Creates Checkbox peer.
The current CheckboxGroup associated with the Checkbox, if any.
The text associated with the Checkbox.
ItemSelectable.getSelectedObjects()
If the Checkbox is checked, returns an array with length 1 containing the label of the Checkbox; otherwise returns null.
The current state of the Checkbox.
The listener to be removed.
ItemSelectable.removeItemListener (ItemListener l)
Removes the specified ItemListener so it will not receive ItemEvent objects from this Checkbox.
New group in which to place the Checkbox.
Associates the Checkbox with a different CheckboxGroup.
New text to associate with Checkbox.
Changes the text associated with the Checkbox.
New state for the Checkbox.
Changes the state of the Checkbox.
String with current settings of Checkbox.
Component.paramString()
Helper method for toString() to generate string of current settings.
The event to process.
Low level AWTEvents are passed to this method for processing.
The item event to process.
Item events are passed to this method for processing. Normally, this method is called by processEvent().
CheckboxGroup, Component, ItemEvent, ItemSelectable, String