java.awt
Class Checkbox
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Checkbox
All Implemented Interfaces:
ItemSelectable, Serializable, ImageObserver, MenuContainer, Serializable
This class implements a component which has an on/off state. Two
or more Checkboxes can be grouped by a CheckboxGroup.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Tom Tromey <tromey@redhat.com>
Checkbox
public Checkbox() Initializes a new instance of Checkbox with no label,
an initial state of off, and that is not part of any checkbox group.
Checkbox
public Checkbox(java.lang.String label) Initializes a new instance of Checkbox with the specified
label, an initial state of off, and that is not part of any checkbox
group.
Parameters:
Checkbox
public Checkbox(java.lang.String label, boolean state) Initializes a new instance of Checkbox with the specified
label and initial state, and that is not part of any checkbox
group.
Parameters:
Checkbox
public Checkbox(java.lang.String label, boolean state, java.awt.CheckboxGroup group) Initializes a new instance of Checkbox with the specified
label, initial state, and checkbox group.
Parameters:
Checkbox
public Checkbox(java.lang.String label, java.awt.CheckboxGroup group, boolean state) Initializes a new instance of Checkbox with the specified
label, initial state, and checkbox group.
Parameters:
addItemListener
public synchronized void addItemListener(java.awt.event.ItemListener listener) Adds a new listeners to the list of registered listeners for this object.
Parameters:
addNotify
public void addNotify() Creates this object's native peer.
getCheckboxGroup
public CheckboxGroup getCheckboxGroup() Returns the checkbox group this object is a member of, if any.
Returns:
- This object's checkbox group, of
null if it is
not a member of any group.
getLabel
public String getLabel() Returns the label for this checkbox.
Returns:
- The label for this checkbox.
getSelectedObjects
public Object[] getSelectedObjects() Returns an array of length one containing the checkbox label if this
checkbox is selected. Otherwise null is returned.
Returns:
- The selection state of this checkbox.
getState
public boolean getState() Returns the state of this checkbox.
Returns:
- The state of this checkbox, which will be
true for
on and false for off.
paramString
protected String paramString() Returns a debugging string for this object.
processEvent
protected void processEvent(java.awt.AWTEvent event) Processes this event by calling processItemEvent() if it
is any instance of ItemEvent. Otherwise it is passed to
the superclass for processing.
Parameters:
processItemEvent
protected void processItemEvent(java.awt.event.ItemEvent event) Processes this event by dispatching it to any registered listeners.
Parameters:
removeItemListener
public synchronized void removeItemListener(java.awt.event.ItemListener listener) Removes a listener from the list of registered listeners for this object.
Parameters:
setCheckboxGroup
public synchronized void setCheckboxGroup(java.awt.CheckboxGroup group) Sets this object's checkbox group to the specified group.
Parameters:
setLabel
public synchronized void setLabel(java.lang.String label) Sets the label for this checkbox to the specified value.
Parameters:
setState
public synchronized void setState(boolean state) Sets the state of this checkbox to the specified value.
Parameters: