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

Class CheckboxMenuItem

java.lang.Object
|
+--java.awt.MenuComponent
   |
   +--java.awt.MenuItem
      |
      +--java.awt.CheckboxMenuItem

All Implemented Interfaces:

ItemSelectable, Serializable, Serializable


public class CheckboxMenuItem

extends MenuItem

implements ItemSelectable

This class implements a menu item that has a checkbox on it indicating the selected state of some option.

Authors:

Constructor Summary

CheckboxMenuItem()

Initializes a new instance of CheckboxMenuItem with no label and an initial state of off.
CheckboxMenuItem(java.lang.String label)

Initializes a new instance of CheckboxMenuItem with the specified label and an initial state of off.
CheckboxMenuItem(java.lang.String label, boolean state)

Initializes a new instance of CheckboxMenuItem with the specified label and initial state.

Method Summary

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

Adds the specified listener to the list of registered item listeners for this object.
synchronized voidaddNotify()

Create's this object's native peer
java.awt.event.ItemListener[]getItemListeners()

Returns an aray of all item listeners currently registered to this CheckBoxMenuItem.
java.util.EventListener[]getListeners(java.lang.Class listenerType)

Returns an array of all the objects currently registered as FooListeners upon this CheckboxMenuItem.
java.lang.Object[]getSelectedObjects()

Returns an array of length 1 with the menu item label for this object if the state is on.
booleangetState()

Returns the state of this menu item.
java.lang.StringparamString()

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

Processes the specified event by calling processItemEvent() if it is an instance of ItemEvent or calling the superclass method otherwise.
voidprocessItemEvent(java.awt.event.ItemEvent event)

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

Removes the specified listener from the list of registered item listeners for this object.
synchronized voidsetState(boolean state)

Sets the state of this menu item.

Constructor Details

CheckboxMenuItem

public CheckboxMenuItem()

Initializes a new instance of CheckboxMenuItem with no label and an initial state of off.

Throws:


CheckboxMenuItem

public CheckboxMenuItem(java.lang.String label)

Initializes a new instance of CheckboxMenuItem with the specified label and an initial state of off.

Parameters:

Throws:


CheckboxMenuItem

public CheckboxMenuItem(java.lang.String label, boolean state)

Initializes a new instance of CheckboxMenuItem with the specified label and initial state.

Parameters:

Throws:


Method Details

addItemListener

public synchronized void addItemListener(java.awt.event.ItemListener listener)

Adds the specified listener to the list of registered item listeners for this object.

Parameters:


addNotify

public synchronized void addNotify()

Create's this object's native peer


getItemListeners

public ItemListener[] getItemListeners()

Returns an aray of all item listeners currently registered to this CheckBoxMenuItem.


getListeners

public EventListener[] getListeners(java.lang.Class listenerType)

Returns an array of all the objects currently registered as FooListeners upon this CheckboxMenuItem. FooListeners are registered using the addFooListener method.

Parameters:

Throws:


getSelectedObjects

public Object[] getSelectedObjects()

Returns an array of length 1 with the menu item label for this object if the state is on. Otherwise null is returned.


getState

public boolean getState()

Returns the state of this menu item.

Returns:


paramString

public String paramString()

Returns a debugging string for this object.

Returns:


processEvent

protected void processEvent(java.awt.AWTEvent event)

Processes the specified event by calling processItemEvent() if it is an instance of ItemEvent or calling the superclass method otherwise.

Parameters:


processItemEvent

protected void processItemEvent(java.awt.event.ItemEvent event)

Processes the specified event by dispatching it to any registered listeners.

Parameters:


removeItemListener

public synchronized void removeItemListener(java.awt.event.ItemListener listener)

Removes the specified listener from the list of registered item listeners for this object.

Parameters:


setState

public synchronized void setState(boolean state)

Sets the state of this menu item.

Parameters: