Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt.event

Class ItemEvent

java.lang.Object
|
+--java.util.EventObject
   |
   +--java.awt.AWTEvent
      |
      +--java.awt.event.ItemEvent


public class ItemEvent

extends AWTEvent

This event is generated when a selection item changes state. This is an abstraction that distills a large number of individual mouse or keyboard events into a simpler "item selected" and "item deselected" events.

Since:Author:See Also:

Field Summary

static intDESELECTED

This type indicates that the item was deselected.
static intITEM_FIRST

This is the first id in the event id range used by this class.
static intITEM_LAST

This is the last id in the event id range used by this class.
static intITEM_STATE_CHANGED

This event id indicates a state change occurred.
static intSELECTED

This type indicates that the item was selected.

Constructor Summary

ItemEvent(java.awt.ItemSelectable source, int id, java.lang.Object item, int stateChange)

Initializes a new instance of ItemEvent with the specified source, id, and state change constant.

Method Summary

java.lang.ObjectgetItem()

Returns the item affected by this state change.
java.awt.ItemSelectablegetItemSelectable()

This method returns the event source as an ItemSelectable.
intgetStateChange()

Returns the type of state change, either #SELECTED or #DESELECTED.
java.lang.StringparamString()

Returns a string identifying this event.

Field Details

DESELECTED

public static final int DESELECTED

This type indicates that the item was deselected.


ITEM_FIRST

public static final int ITEM_FIRST

This is the first id in the event id range used by this class.


ITEM_LAST

public static final int ITEM_LAST

This is the last id in the event id range used by this class.


ITEM_STATE_CHANGED

public static final int ITEM_STATE_CHANGED

This event id indicates a state change occurred.


SELECTED

public static final int SELECTED

This type indicates that the item was selected.


Constructor Details

ItemEvent

public ItemEvent(java.awt.ItemSelectable source, int id, java.lang.Object item, int stateChange)

Initializes a new instance of ItemEvent with the specified source, id, and state change constant. Note that an invalid id leads to unspecified results.

Parameters:


Method Details

getItem

public Object getItem()

Returns the item affected by this state change.

Returns:


getItemSelectable

public ItemSelectable getItemSelectable()

This method returns the event source as an ItemSelectable.

Returns:

Throws:


getStateChange

public int getStateChange()

Returns the type of state change, either #SELECTED or #DESELECTED.

Returns:


paramString

public String paramString()

Returns a string identifying this event. This is in the format: "ITEM_STATE_CHANGED,item=" + item + ",stateChange=" + (getStateChange() == DESELECTED ? "DESELECTED" : "SELECTED").

Returns: