java.lang.Object | |||
↳ | java.util.EventObject | ||
↳ | java.awt.AWTEvent | ||
↳ | java.awt.event.ItemEvent |
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".
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DESELECTED | This state-change-value indicates that a selected item was deselected. | |||||||||
int | ITEM_FIRST | The first number in the range of ids used for item events. | |||||||||
int | ITEM_LAST | The last number in the range of ids used for item events. | |||||||||
int | ITEM_STATE_CHANGED | This event id indicates that an item's state changed. | |||||||||
int | SELECTED | This state-change value indicates that an item was selected. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.awt.AWTEvent
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.awt.AWTEvent
| |||||||||||
From class
java.util.EventObject
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs an
ItemEvent object. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the item affected by the event.
| |||||||||||
Returns the originator of the event.
| |||||||||||
Returns the type of state change (selected or deselected).
| |||||||||||
Returns a parameter string identifying this item event.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.awt.AWTEvent
| |||||||||||
From class
java.util.EventObject
| |||||||||||
From class
java.lang.Object
|
This state-change-value indicates that a selected item was deselected.
The first number in the range of ids used for item events.
The last number in the range of ids used for item events.
This event id indicates that an item's state changed.
This state-change value indicates that an item was selected.
Constructs an ItemEvent
object.
Note that passing in an invalid id
results in
unspecified behavior. This method throws an
IllegalArgumentException
if source
is null
.
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 |
IllegalArgumentException | if source is null
|
---|
Returns the item affected by the event.
Returns the originator of the event.
Returns the type of state change (selected or deselected).
Returns a parameter string identifying this item event. This method is useful for event-logging and for debugging.