java::awt::CheckboxMenuItem Class Reference

Inheritance diagram for java::awt::CheckboxMenuItem:

Inheritance graph
java::awt::MenuItemjava::awt::MenuComponentjava::lang::Objectjava::lang::Interfacejava::lang::Syncjava::awt::event::ActionSourcejava::awt::ItemCheckablejava::awt::event::ItemSourcejava::lang::Lockjava::lang::ScopeAdapterjava::util::EventSourcejava::awt::ItemSelectable
[legend]
Collaboration diagram for java::awt::CheckboxMenuItem:

Collaboration graph
java::awt::MenuItemjava::awt::MenuComponentjava::lang::Objectjava::lang::Interfacejava::lang::ObjectRefjava::lang::Syncjava::awt::event::ActionSourcejava::awt::ItemCheckablejava::awt::event::ItemSourcejava::lang::Lockjava::lang::ScopeAdapterjava::lang::Comparablejava::util::EventSourcejava::util::Collectionjava::awt::ItemSelectablejava::util::LinkedListjava::util::AbstractSequentialListjava::util::AbstractListjava::util::AbstractCollectionjava::util::List
[legend]

List of all members.


Detailed Description

This class represents a check box that can be included in a menu.

Selecting the check box in the menu changes its state from "on" to "off" or from "off" to "on."

The following picture depicts a menu which contains an instance of CheckBoxMenuItem:

MenuBar-1.gif

The item labeled Check shows a check box menu item in its "off" state.

When a check box menu item is selected, AWT sends an item event to the item. Since the event is an instance of ItemEvent, the processEvent method examines the event and passes it along to processItemEvent. The latter method redirects the event to any ItemListener objects that have registered an interest in item events generated by this menu item.

Version:
1.66, 01/23/03
Author:
Sami Shaio
See also:
java.awt.event.ItemEvent

java.awt.event.ItemListener

Since:
JDK1.0

Public Member Functions

 CheckboxMenuItem (const String &label=nilString, jboolean state=false, const Ref< CheckboxGroup > &group=0)
 Create a check box menu item with the specified label and state.
virtual void setState (jboolean b)
 Sets this check box menu item to the specifed state.
virtual Ref< ListgetSelectedObjects () const
 Returns the an array (length 1) containing the checkbox menu item label or null if the checkbox is not selected.
virtual String toString () const
 Returns a representation of this menu component as a string.

Constructor & Destructor Documentation

java::awt::CheckboxMenuItem::CheckboxMenuItem ( const String label = nilString,
jboolean  state = false,
const Ref< CheckboxGroup > &  group = 0 
)

Create a check box menu item with the specified label and state.

Parameters:
label a string label for the check box menu item, or null for an unlabeled menu item.
state the initial state of the menu item, where true indicates "on" and false indicates "off."
group a check box group for this check box, or null for no group.
Exceptions:
HeadlessException if GraphicsEnvironment.isHeadless() returns true
See also:
java.awt.GraphicsEnvironment::isHeadless
Since:
JDK1.1


Member Function Documentation

virtual void java::awt::CheckboxMenuItem::setState ( jboolean  b  )  [virtual]

Sets this check box menu item to the specifed state.

The boolean value true indicates "on" while false indicates "off."

Note that this method should be primarily used to initialize the state of the check box menu item. Programmatically setting the state of the check box menu item will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction.

Parameters:
b true if the check box menu item is on, otherwise false
See also:
getState

Reimplemented from java::awt::ItemCheckable.

virtual Ref<List> java::awt::CheckboxMenuItem::getSelectedObjects (  )  const [virtual]

Returns the an array (length 1) containing the checkbox menu item label or null if the checkbox is not selected.

See also:
ItemSelectable

Implements java::awt::ItemSelectable.

virtual String java::awt::CheckboxMenuItem::toString (  )  const [virtual]

Returns a representation of this menu component as a string.

Returns:
a string representation of this menu component

Reimplemented from java::awt::MenuItem.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:55:54 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3