|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt
Class Checkbox

java.lang.Objectjava.awt.Component
java.awt.Checkbox
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, ItemSelectable, MenuContainer, java.io.Serializable
- public class Checkbox
- extends Component
- implements ItemSelectable, javax.accessibility.Accessible, java.io.Serializable
- extends Component
This class implements a component which has an on/off state. Two or more Checkboxes can be grouped by a CheckboxGroup.
| Nested Class Summary | |
protected class |
Checkbox.AccessibleAWTCheckbox
This class provides accessibility support for the checkbox. |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy, Component.HeavyweightInLightweightListener |
| Field Summary | |
private CheckboxGroup |
group
|
private java.awt.event.ItemListener |
item_listeners
|
private java.lang.String |
label
|
private static long |
next_checkbox_number
|
private static long |
serialVersionUID
|
(package private) boolean |
state
|
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| 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,
boolean state,
CheckboxGroup group)
Initializes a new instance of Checkbox with the specified
label, initial state, and checkbox group. |
|
Checkbox(java.lang.String label,
CheckboxGroup group,
boolean state)
Initializes a new instance of Checkbox with the specified
label, initial state, and checkbox group. |
|
| Method Summary | |
void |
addItemListener(java.awt.event.ItemListener listener)
Adds a new listeners to the list of registered listeners for this object. |
void |
addNotify()
Creates this object's native peer. |
(package private) void |
dispatchEventImpl(AWTEvent e)
Implementation of dispatchEvent. |
(package private) java.lang.String |
generateName()
Generate a unique name for this checkbox. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this Checkbox. |
CheckboxGroup |
getCheckboxGroup()
Returns the checkbox group this object is a member of, if any. |
java.awt.event.ItemListener[] |
getItemListeners()
|
java.lang.String |
getLabel()
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. |
boolean |
getState()
Returns the state of this checkbox. |
private static long |
getUniqueLong()
|
protected java.lang.String |
paramString()
Returns a debugging string for this object. |
protected void |
processEvent(AWTEvent event)
Processes this event by calling processItemEvent() if it
is any instance of ItemEvent. |
protected void |
processItemEvent(java.awt.event.ItemEvent event)
Processes this event by dispatching it to any registered listeners. |
void |
removeItemListener(java.awt.event.ItemListener listener)
Removes a listener from the list of registered listeners for this object. |
void |
setCheckboxGroup(CheckboxGroup group)
Sets this object's checkbox group to the specified group. |
void |
setLabel(java.lang.String label)
Sets the label for this checkbox to the specified value. |
void |
setState(boolean state)
Sets the state of this checkbox to the specified value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
group
private CheckboxGroup group
label
private java.lang.String label
state
boolean state
item_listeners
private transient java.awt.event.ItemListener item_listeners
next_checkbox_number
private static transient long next_checkbox_number
| Constructor Detail |
Checkbox
public Checkbox()
- Initializes a new instance of
Checkboxwith 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
Checkboxwith the specified label, an initial state of off, and that is not part of any checkbox group.
Checkbox
public Checkbox(java.lang.String label, boolean state)
- Initializes a new instance of
Checkboxwith the specified label and initial state, and that is not part of any checkbox group.
Checkbox
public Checkbox(java.lang.String label, CheckboxGroup group, boolean state)
- Initializes a new instance of
Checkboxwith the specified label, initial state, and checkbox group.
Checkbox
public Checkbox(java.lang.String label, boolean state, CheckboxGroup group)
- Initializes a new instance of
Checkboxwith the specified label, initial state, and checkbox group.
| Method Detail |
getLabel
public java.lang.String getLabel()
- Returns the label for this checkbox.
setLabel
public void setLabel(java.lang.String label)
- Sets the label for this checkbox to the specified value.
getState
public boolean getState()
- Returns the state of this checkbox.
setState
public void setState(boolean state)
- Sets the state of this checkbox to the specified value.
getSelectedObjects
public java.lang.Object[] getSelectedObjects()
- Returns an array of length one containing the checkbox label if this
checkbox is selected. Otherwise
nullis returned.- Specified by:
getSelectedObjectsin interfaceItemSelectable
getCheckboxGroup
public CheckboxGroup getCheckboxGroup()
- Returns the checkbox group this object is a member of, if any.
setCheckboxGroup
public void setCheckboxGroup(CheckboxGroup group)
- Sets this object's checkbox group to the specified group.
addNotify
public void addNotify()
getItemListeners
public java.awt.event.ItemListener[] getItemListeners()
addItemListener
public void addItemListener(java.awt.event.ItemListener listener)
- Adds a new listeners to the list of registered listeners for this object.
- Specified by:
addItemListenerin interfaceItemSelectable
removeItemListener
public void removeItemListener(java.awt.event.ItemListener listener)
- Removes a listener from the list of registered listeners for this object.
- Specified by:
removeItemListenerin interfaceItemSelectable
processEvent
protected void processEvent(AWTEvent event)
- Processes this event by calling
processItemEvent()if it is any instance ofItemEvent. Otherwise it is passed to the superclass for processing.- Overrides:
processEventin classComponent
processItemEvent
protected void processItemEvent(java.awt.event.ItemEvent event)
- Processes this event by dispatching it to any registered listeners.
dispatchEventImpl
void dispatchEventImpl(AWTEvent e)
- Description copied from class:
Component - Implementation of dispatchEvent. Allows trusted package classes
to dispatch additional events first. This implementation first
translates
eto an AWT 1.0 event and sends the result toComponent.postEvent(java.awt.Event)55 . If the AWT 1.0 event is not handled, and events of typeeare enabled for this component, e is passed on toComponent.processEvent(java.awt.AWTEvent)55 .- Overrides:
dispatchEventImplin classComponent
paramString
protected java.lang.String paramString()
- Returns a debugging string for this object.
- Overrides:
paramStringin classComponent
getAccessibleContext
public javax.accessibility.AccessibleContext getAccessibleContext()
- Gets the AccessibleContext associated with this
Checkbox. The context is created, if necessary.- Specified by:
getAccessibleContextin interfacejavax.accessibility.Accessible- Overrides:
getAccessibleContextin classComponent
generateName
java.lang.String generateName()
- Generate a unique name for this checkbox.
- Overrides:
generateNamein classComponent
getUniqueLong
private static long getUniqueLong()
|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC