| |
|
| java.awt.AWTEvent java.awt.event.ItemEvent
ItemEvent | public class ItemEvent extends AWTEvent (Code) | | 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.38 06/05/07 author: Carl Quinn See Also: java.awt.ItemSelectable See Also: ItemListener See Also: Tutorial: Writing an Item Listener since: 1.1 |
Field Summary | |
final public static int | DESELECTED This state-change-value indicates that a selected item was deselected. | final public static int | ITEM_FIRST The first number in the range of ids used for item events. | final public static int | ITEM_LAST The last number in the range of ids used for item events. | final public static int | ITEM_STATE_CHANGED This event id indicates that an item's state changed. | final public static int | SELECTED This state-change value indicates that an item was selected. | Object | item The item whose selection state has changed. | int | stateChange stateChange indicates whether the item
was selected or deselected. |
Constructor Summary | |
public | ItemEvent(ItemSelectable source, int id, Object item, int stateChange) Constructs an ItemEvent object.
Note that passing in an invalid id results in
unspecified behavior. |
DESELECTED | final public static int DESELECTED(Code) | | This state-change-value indicates that a selected item was deselected.
|
ITEM_FIRST | final public static int ITEM_FIRST(Code) | | The first number in the range of ids used for item events.
|
ITEM_LAST | final public static int ITEM_LAST(Code) | | The last number in the range of ids used for item events.
|
ITEM_STATE_CHANGED | final public static int ITEM_STATE_CHANGED(Code) | | This event id indicates that an item's state changed.
|
SELECTED | final public static int SELECTED(Code) | | This state-change value indicates that an item was selected.
|
ItemEvent | public ItemEvent(ItemSelectable source, int id, Object item, int stateChange)(Code) | | Constructs an ItemEvent object.
Note that passing in an invalid id results in
unspecified behavior. This method throws an
IllegalArgumentException if source
is null .
Parameters: source - the ItemSelectable objectthat originated the event Parameters: id - an integer that identifies the event type Parameters: item - an object -- the item affected by the event Parameters: stateChange - an integer that indicates whether the item wasselected or deselected throws: IllegalArgumentException - if source is null |
getItem | public Object getItem()(Code) | | Returns the item affected by the event.
the item (object) that was affected by the event |
getItemSelectable | public ItemSelectable getItemSelectable()(Code) | | Returns the originator of the event.
the ItemSelectable object that originated the event. |
getStateChange | public int getStateChange()(Code) | | Returns the type of state change (selected or deselected).
an integer that indicates whether the item was selectedor deselected See Also: ItemEvent.SELECTED See Also: ItemEvent.DESELECTED |
paramString | public String paramString()(Code) | | Returns a parameter string identifying this item event.
This method is useful for event-logging and for debugging.
a string identifying the event and its attributes |
|
|
|