java.awt.event
Class ItemEvent
java.lang.Object
|
+--java.util.EventObject
|
+--java.awt.AWTEvent
|
+--java.awt.event.ItemEvent
This event is generated when a selection item changes state. This is an
abstraction that distills a large number of individual mouse or keyboard
events into a simpler "item selected" and "item deselected" events.
Since:Author:- Aaron M. Renn <arenn@urbanophile.com>
See Also:
DESELECTED
public static final int DESELECTED
This type indicates that the item was deselected.
ITEM_FIRST
public static final int ITEM_FIRST
This is the first id in the event id range used by this class.
ITEM_LAST
public static final int ITEM_LAST
This is the last id in the event id range used by this class.
ITEM_STATE_CHANGED
public static final int ITEM_STATE_CHANGED
This event id indicates a state change occurred.
SELECTED
public static final int SELECTED
This type indicates that the item was selected.
ItemEvent
public ItemEvent(java.awt.ItemSelectable source, int id, java.lang.Object item, int stateChange)
Initializes a new instance of ItemEvent
with the specified
source, id, and state change constant. Note that an invalid id leads to
unspecified results.
Parameters:
getItem
public Object getItem()
Returns the item affected by this state change.
Returns:
- the item affected by this state change
getItemSelectable
public ItemSelectable getItemSelectable()
This method returns the event source as an ItemSelectable
.
Returns:
- the event source as an
ItemSelected
Throws:
getStateChange
public int getStateChange()
Returns the type of state change, either #SELECTED or
#DESELECTED.
Returns:
paramString
public String paramString()
Returns a string identifying this event. This is in the format:
"ITEM_STATE_CHANGED,item=" + item + ",stateChange="
+ (getStateChange() == DESELECTED ? "DESELECTED" : "SELECTED")
.
Returns:
- a string identifying this event