Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt

Class Checkbox

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

All Implemented Interfaces:

ItemSelectable, Serializable, ImageObserver, MenuContainer, Serializable


public class Checkbox

extends Component

implements ItemSelectable, Serializable

This class implements a component which has an on/off state. Two or more Checkboxes can be grouped by a CheckboxGroup.

Authors:

Constructor Summary

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(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.
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.
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.
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.

Method Summary

synchronized voidaddItemListener(java.awt.event.ItemListener listener)

Adds a new listeners to the list of registered listeners for this object.
voidaddNotify()

Creates this object's native peer.
java.awt.CheckboxGroupgetCheckboxGroup()

Returns the checkbox group this object is a member of, if any.
java.lang.StringgetLabel()

Returns the label for this checkbox.
java.lang.Object[]getSelectedObjects()

Returns an array of length one containing the checkbox label if this checkbox is selected.
booleangetState()

Returns the state of this checkbox.
java.lang.StringparamString()

Returns a debugging string for this object.
voidprocessEvent(java.awt.AWTEvent event)

Processes this event by calling processItemEvent() if it is any instance of ItemEvent.
voidprocessItemEvent(java.awt.event.ItemEvent event)

Processes this event by dispatching it to any registered listeners.
synchronized voidremoveItemListener(java.awt.event.ItemListener listener)

Removes a listener from the list of registered listeners for this object.
synchronized voidsetCheckboxGroup(java.awt.CheckboxGroup group)

Sets this object's checkbox group to the specified group.
synchronized voidsetLabel(java.lang.String label)

Sets the label for this checkbox to the specified value.
synchronized voidsetState(boolean state)

Sets the state of this checkbox to the specified value.

Constructor Details

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:


Method Details

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:


getLabel

public String getLabel()

Returns the label for this checkbox.

Returns:


getSelectedObjects

public Object[] getSelectedObjects()

Returns an array of length one containing the checkbox label if this checkbox is selected. Otherwise null is returned.

Returns:


getState

public boolean getState()

Returns the state of this checkbox.

Returns:


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: