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".
An unspecified behavior will be caused if the id parameter
of any particular ItemEvent instance is not
in the range from ITEM_FIRST to ITEM_LAST.
The stateChange of any ItemEvent instance takes one of the following
values:
ItemEvent.SELECTED
ItemEvent.DESELECTED
java.awt.ItemSelectable , ItemListener, Tutorial: Writing an Item Listener
| Modifier and Type | Field and Description |
|---|---|
| public static final int | DESELECTED
This state-change-value indicates that a selected item was deselected. |
| pack-priv Object | item
The item whose selection state has changed. |
| public static final int | ITEM_FIRST
The first number in the range of ids used for item events. |
| public static final int | ITEM_LAST
The last number in the range of ids used for item events. |
| public static final int | ITEM_STATE_CHANGED
This event id indicates that an item's state changed. |
| public static final int | SELECTED
This state-change value indicates that an item was selected. |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.1 for interoperability.
|
| pack-priv int | stateChange
|
| Access | Constructor and Description |
|---|---|
| public | ItemEvent(ItemSelectable
The source, int ItemSelectable object
that originated the eventThe integer that identifies the event type.
For information on allowable values, see
the class description for id, Object ItemEventAn object -- the item affected by the event item, int An integer that indicates whether the item was
selected or deselected.
For information on allowable values, see
the class description for stateChange)ItemEventConstructs an |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: the item (object) that was affected by the eventReturns the item affected by the event. |
| public ItemSelectable | Returns: the ItemSelectable object that originated the event.Returns the originator of the event. |
| public int | Returns: an integer that indicates whether the item was selected or deselectedReturns the type of state change (selected or deselected). |
| public String | Returns: a string identifying the event and its attributesOverrides java. Returns a parameter string identifying this item event. |
| DESELECTED | back to summary |
|---|---|
| public static final int DESELECTED This state-change-value indicates that a selected item was deselected. | |
| item | back to summary |
|---|---|
| pack-priv Object item The item whose selection state has changed.
| |
| ITEM_FIRST | back to summary |
|---|---|
| public static final int ITEM_FIRST The first number in the range of ids used for item events. | |
| ITEM_LAST | back to summary |
|---|---|
| public static final int ITEM_LAST The last number in the range of ids used for item events. | |
| ITEM_STATE_CHANGED | back to summary |
|---|---|
| public static final int ITEM_STATE_CHANGED This event id indicates that an item's state changed. | |
| SELECTED | back to summary |
|---|---|
| public static final int SELECTED This state-change value indicates that an item was selected. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Use serialVersionUID from JDK 1.1 for interoperability. | |
| stateChange | back to summary |
|---|---|
| pack-priv int stateChange
| |
| ItemEvent | back to summary |
|---|---|
| public ItemEvent(ItemSelectable source, int id, Object item, int stateChange) Constructs an This method throws an
| |
| getItem | back to summary |
|---|---|
| public Object getItem() Returns the item affected by the event.
| |
| getItemSelectable | back to summary |
|---|---|
| public ItemSelectable getItemSelectable() Returns the originator of the event.
| |
| getStateChange | back to summary |
|---|---|
| public int getStateChange() Returns the type of state change (selected or deselected).
| |
| paramString | back to summary |
|---|---|
| public String paramString() Overrides java. Returns a parameter string identifying this item event. This method is useful for event-logging and for debugging.
| |