public class ItemEvent extends AWTEvent
ItemSelectable,
ItemListener,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
DESELECTED
This type indicates that the item was deselected.
|
static int |
ITEM_FIRST
This is the first id in the event id range used by this class.
|
static int |
ITEM_LAST
This is the last id in the event id range used by this class.
|
static int |
ITEM_STATE_CHANGED
This event id indicates a state change occurred.
|
static int |
SELECTED
This type indicates that the item was selected.
|
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASKsource| Constructor and Description |
|---|
ItemEvent(ItemSelectable source,
int id,
Object item,
int stateChange)
Initializes a new instance of
ItemEvent with the specified
source, id, and state change constant. |
| Modifier and Type | Method and Description |
|---|---|
Object |
getItem()
Returns the item affected by this state change.
|
ItemSelectable |
getItemSelectable()
This method returns the event source as an
ItemSelectable. |
int |
getStateChange()
Returns the type of state change, either
SELECTED or
DESELECTED. |
String |
paramString()
Returns a string identifying this event.
|
getSourcepublic static final int ITEM_FIRST
public static final int ITEM_LAST
public static final int ITEM_STATE_CHANGED
public static final int SELECTED
public static final int DESELECTED
public ItemEvent(ItemSelectable source, int id, Object item, int stateChange)
ItemEvent with the specified
source, id, and state change constant. Note that an invalid id leads to
unspecified results.source - the source of the eventid - the event iditem - the item affected by the state changestateChange - one of SELECTED or DESELECTEDpublic ItemSelectable getItemSelectable()
ItemSelectable.ItemSelectedClassCastException - if source is changed to a non-ItemSelectablepublic Object getItem()
public int getStateChange()
SELECTED or
DESELECTED.public String paramString()
"ITEM_STATE_CHANGED,item=" + item + ",stateChange="
+ (getStateChange() == DESELECTED ? "DESELECTED" : "SELECTED").paramString in class AWTEvent