java::awt::event::ItemEvent Class Reference

Inheritance diagram for java::awt::event::ItemEvent:

Inheritance graph
java::awt::AWTEventjava::util::EventObjectjava::lang::Object
[legend]
Collaboration diagram for java::awt::event::ItemEvent:

Collaboration graph
java::awt::AWTEventjava::util::EventObjectjava::lang::Objectjava::lang::ObjectRefjava::lang::Interfacejava::lang::Comparable
[legend]

List of all members.


Detailed Description

A semantic event which indicates that an item was selected or deselected.

This high-level event is generated by an ItemSelectable object (such as a List) when an item is selected or deselected by the user. The event is passed to every ItemListener object which registered to receive such events using the component's addItemListener method.

The object that implements the ItemListener interface gets this ItemEvent when the event occurs. The listener is spared the details of processing individual mouse movements and mouse clicks, and can instead process a "meaningful" (semantic) event like "item selected" or "item deselected".

Version:
1.26 01/23/03
Author:
Carl Quinn
See also:
java.awt.ItemSelectable

ItemListener

Tutorial: Writing an Item Listener

Reference: The Java Class Libraries (update file)

Since:
1.1

Public Types

enum  ITEM_EVENT_ID { ITEM_FIRST = 701, ITEM_STATE_CHANGED = ITEM_FIRST, ITEM_LAST = ITEM_STATE_CHANGED }
enum  STATE_CHANGE_VALUE { DESELECTED = 0, SELECTED }

Public Member Functions

 ItemEvent (const Ref< ItemSelectable > &source=0, jint id=ITEM_STATE_CHANGED, const ObjectRef &item=0, jint stateChange=SELECTED)
 Constructs an ItemEvent object.
virtual Ref
< ItemSelectable
getItemSelectable () const
 Returns the originator of the event.
virtual ObjectRef getItem () const
 Returns the item affected by the event.
virtual jint getStateChange () const
 Returns the type of state change (selected or deselected).
virtual String paramString () const
 Returns a parameter string identifying this item event.

Protected Attributes

ObjectRef item
 The item whose selection state has changed.
jint stateChange
 stateChange indicates whether the item was selected or deselected.

Member Enumeration Documentation

enum java::awt::event::ItemEvent::ITEM_EVENT_ID

Enumerator:
ITEM_FIRST  The first number in the range of ids used for item events.
ITEM_STATE_CHANGED  This event id indicates that an item's state changed.
ITEM_LAST  The last number in the range of ids used for item events.

enum java::awt::event::ItemEvent::STATE_CHANGE_VALUE

Enumerator:
DESELECTED  This state-change-value indicates that a selected item was deselected.
SELECTED  This state-change value indicates that an item was selected.


Constructor & Destructor Documentation

java::awt::event::ItemEvent::ItemEvent ( const Ref< ItemSelectable > &  source = 0,
jint  id = ITEM_STATE_CHANGED,
const ObjectRef item = 0,
jint  stateChange = SELECTED 
)

Constructs an ItemEvent object.

Note that passing in an invalid id results in unspecified behavior.

Parameters:
source the ItemSelectable object that originated the event
id an integer that identifies the event type
item an object -- the item affected by the event
stateChange an integer that indicates whether the item was selected or deselected


Member Function Documentation

virtual Ref<ItemSelectable> java::awt::event::ItemEvent::getItemSelectable (  )  const [virtual]

Returns the originator of the event.

Returns:
the ItemSelectable object that originated the event.

virtual ObjectRef java::awt::event::ItemEvent::getItem (  )  const [virtual]

Returns the item affected by the event.

Returns:
the item (object) that was affected by the event

virtual jint java::awt::event::ItemEvent::getStateChange (  )  const [virtual]

Returns the type of state change (selected or deselected).

Returns:
an integer that indicates whether the item was selected or deselected
See also:
SELECTED

DESELECTED

virtual String java::awt::event::ItemEvent::paramString (  )  const [virtual]

Returns a parameter string identifying this item event.

This method is useful for event-logging and for debugging.

Returns:
a string identifying the event and its associated command

Reimplemented from java::awt::AWTEvent.


Member Data Documentation

ObjectRef java::awt::event::ItemEvent::item [protected]

The item whose selection state has changed.

See also:
getItem()

jint java::awt::event::ItemEvent::stateChange [protected]

stateChange indicates whether the item was selected or deselected.

See also:
getStateChange()


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