    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.

##

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

##

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

##

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.

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

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

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

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.

##

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

getLabel

      public String getLabel()

  Gets the label of the check box.

  See Also:
    setLabel

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

getState

      public boolean getState()

  Returns the boolean state of the Checkbox.

  See Also:
    setState

setState

      public void setState(boolean state)

  Sets the Checkbox to the specifed boolean state.

  Parameters:
    state - the boolean state
  See Also:
    getState

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

getCheckboxGroup

      public CheckboxGroup getCheckboxGroup()

  Returns the checkbox group.

  See Also:
    setCheckboxGroup

setCheckboxGroup

      public void setCheckboxGroup(CheckboxGroup g)

  Sets the CheckboxGroup to the specified group.

  Parameters:
    g - the new CheckboxGroup
  See Also:
    getCheckboxGroup

addItemListener

      public void addItemListener(ItemListener l)

  Adds the specified item listener to recieve item events from this checkbox.

  Parameters:
    l - the item listener

removeItemListener

      public 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

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

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

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