All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.Checkbox

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Checkbox

public class Checkbox
extends Component
implements ItemSelectable
A Checkbox object is a graphical user interface element that has a boolean state.


Constructor Index

 o Checkbox()
Constructs a Checkbox with an empty label.
 o Checkbox(String)
Constructs a Checkbox with the specified label.
 o Checkbox(String, boolean)
Constructs a Checkbox with the specified label.
 o Checkbox(String, boolean, CheckboxGroup)
Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.
 o Checkbox(String, CheckboxGroup, boolean)
Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.

Method Index

 o addItemListener(ItemListener)
Adds the specified item listener to recieve item events from this checkbox.
 o addNotify()
Creates the peer of the Checkbox.
 o getCheckboxGroup()
Returns the checkbox group.
 o getLabel()
Gets the label of the check box.
 o getSelectedObjects()
Returns the an array (length 1) containing the checkbox label or null if the checkbox is not selected.
 o getState()
Returns the boolean state of the Checkbox.
 o paramString()
Returns the parameter String of this Checkbox.
 o processEvent(AWTEvent)
Processes events on this checkbox.
 o processItemEvent(ItemEvent)
Processes item events occurring on this checkbox by dispatching them to any registered ItemListener objects.
 o removeItemListener(ItemListener)
Removes the specified item listener so that it no longer receives item events from this checkbox.
 o setCheckboxGroup(CheckboxGroup)
Sets the CheckboxGroup to the specified group.
 o setLabel(String)
Sets this check box's label to be the specified string.
 o setState(boolean)
Sets the Checkbox to the specifed boolean state.

Constructors

 o Checkbox
 public Checkbox()
Constructs a Checkbox with an empty label. The check box starts in a false state and is not part of any check box group.

 o Checkbox
 public Checkbox(String label)
Constructs a Checkbox with the specified label. The check box starts in a false state and is not part of any check box group.

Parameters:
label - the label on the Checkbox
 o Checkbox
 public Checkbox(String label,
                 boolean state)
Constructs a Checkbox with the specified label. The check box starts in the specified state and is not part of any check box group.

Parameters:
label - the label on the Checkbox
state - is the initial state of this Checkbox
group - the CheckboxGroup this Checkbox is in
 o Checkbox
 public Checkbox(String label,
                 boolean state,
                 CheckboxGroup group)
Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.

Parameters:
label - the label on the Checkbox
state - is the initial state of this Checkbox
group - the CheckboxGroup this Checkbox is in
 o Checkbox
 public Checkbox(String label,
                 CheckboxGroup group,
                 boolean state)
Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.

Methods

 o addNotify
 public void addNotify()
Creates the peer of the Checkbox. The peer allows you to change the look of the Checkbox without changing its functionality.

Overrides:
addNotify in class Component
 o getLabel
 public String getLabel()
Gets the label of the check box.

See Also:
setLabel
 o setLabel
 public synchronized void setLabel(String label)
Sets this check box's label to be the specified string.

Parameters:
label - the label of the button
See Also:
getLabel
 o getState
 public boolean getState()
Returns the boolean state of the Checkbox.

See Also:
setState
 o setState
 public void setState(boolean state)
Sets the Checkbox to the specifed boolean state.

Parameters:
state - the boolean state
See Also:
getState
 o getSelectedObjects
 public Object[] getSelectedObjects()
Returns the an array (length 1) containing the checkbox label or null if the checkbox is not selected.

See Also:
ItemSelectable
 o getCheckboxGroup
 public CheckboxGroup getCheckboxGroup()
Returns the checkbox group.

See Also:
setCheckboxGroup
 o setCheckboxGroup
 public void setCheckboxGroup(CheckboxGroup g)
Sets the CheckboxGroup to the specified group.

Parameters:
g - the new CheckboxGroup
See Also:
getCheckboxGroup
 o addItemListener
 public synchronized void addItemListener(ItemListener l)
Adds the specified item listener to recieve item events from this checkbox.

Parameters:
l - the item listener
 o removeItemListener
 public synchronized void removeItemListener(ItemListener l)
Removes the specified item listener so that it no longer receives item events from this checkbox.

Parameters:
l - the item listener
 o processEvent
 protected void processEvent(AWTEvent e)
Processes events on this checkbox. If the event is an ItemEvent, it invokes the handleItemEvent method, else it calls its superclass's processEvent.

Parameters:
e - the event
Overrides:
processEvent in class Component
 o processItemEvent
 protected void processItemEvent(ItemEvent e)
Processes item events occurring on this checkbox by dispatching them to any registered ItemListener objects. NOTE: This method will not be called unless item events are enabled for this component; this happens when one of the following occurs: a) An ItemListener object is registered via addItemListener() b) Item events are enabled via enableEvents()

Parameters:
e - the item event
See Also:
enableEvents
 o paramString
 protected String paramString()
Returns the parameter String of this Checkbox.

Overrides:
paramString in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index