java.awt.event
Class ItemEvent
- java.lang.Object
-
- java.util.EventObject
-
- java.awt.AWTEvent
-
- java.awt.event.ItemEvent
-
- All Implemented Interfaces:
- java.io.Serializable
public class ItemEvent extends AWTEventA 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 everyItemListener
object which registered to receive such events using the component'saddItemListener
method.The object that implements the
ItemListener
interface gets thisItemEvent
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 particularItemEvent
instance is not in the range fromITEM_FIRST
toITEM_LAST
.The
stateChange
of anyItemEvent
instance takes one of the following values:-
ItemEvent.SELECTED
-
ItemEvent.DESELECTED
- Since:
- 1.1
- See Also:
ItemSelectable
,ItemListener
, Tutorial: Writing an Item Listener, Serialized Form
-
-
Fields Modifier and Type Field and Description ACTION_EVENT_MASK The event mask for selecting action events.ADJUSTMENT_EVENT_MASK The event mask for selecting adjustment events.COMPONENT_EVENT_MASK The event mask for selecting component events.consumed Controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not.CONTAINER_EVENT_MASK The event mask for selecting container events.DESELECTED This state-change-value indicates that a selected item was deselected.FOCUS_EVENT_MASK The event mask for selecting focus events.HIERARCHY_BOUNDS_EVENT_MASK The event mask for selecting hierarchy bounds events.HIERARCHY_EVENT_MASK The event mask for selecting hierarchy events.id The event's id.INPUT_METHOD_EVENT_MASK The event mask for selecting input method events.INVOCATION_EVENT_MASK The event mask for selecting invocation events.ITEM_EVENT_MASK The event mask for selecting item events.ITEM_FIRST The first number in the range of ids used for item events.ITEM_LAST The last number in the range of ids used for item events.ITEM_STATE_CHANGED This event id indicates that an item's state changed.KEY_EVENT_MASK The event mask for selecting key events.MOUSE_EVENT_MASK The event mask for selecting mouse events.MOUSE_MOTION_EVENT_MASK The event mask for selecting mouse motion events.MOUSE_WHEEL_EVENT_MASK The event mask for selecting mouse wheel events.PAINT_EVENT_MASK The event mask for selecting paint events.RESERVED_ID_MAX The maximum value for reserved AWT event IDs.SELECTED This state-change value indicates that an item was selected.source The object on which the Event initially occurred.TEXT_EVENT_MASK The event mask for selecting text events.WINDOW_EVENT_MASK The event mask for selecting window events.WINDOW_FOCUS_EVENT_MASK The event mask for selecting window focus events.WINDOW_STATE_EVENT_MASK The event mask for selecting window state events.
-
Methods Modifier and Type Method and Description consume Consumes this event, if this event can be consumed.getID Returns the event type.getItem Returns the item affected by the event.getItemSelectable Returns the originator of the event.getSource The object on which the Event initially occurred.getStateChange Returns the type of state change (selected or deselected).isConsumed Returns whether this event has been consumed.paramString Returns a parameter string identifying this item event.setSource Retargets an event to a new source.toString Returns a String representation of this object.
-