com.droplets.api.event
Class ItemEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.droplets.api.event.ItemEvent
All Implemented Interfaces:
java.io.Serializable

public class ItemEvent
extends java.util.EventObject

Represents an event that indicates that an item within a list of zero or more items was selected or deselected.

This event is generated by an ItemSelectable object (such as a CheckboxMenuItem object) when it is selected or deselected. Listener objects register using the ItemSelectable.addItemListener(ItemListener) method.

See Also:
Serialized Form

Field Summary
static int DESELECTED
          Indicates that the current state of the subject item is deselected.
static int SELECTED
          Indicates that the current state of the subject item is selected.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ItemEvent(ItemSelectable source, java.lang.Object item, int stateChange)
          Constructs a new ItemEvent object given the following information: a selectable item that generated the event (for example, a CheckboxMenuItem), the item affected by the event (in the case of a CheckboxMenuItem, this is a String that represents its label), and an integer that indicates whether the item was SELECTED or DESELECTED.
 
Method Summary
 java.lang.Object getItem()
          Returns the item to which this event pertains.
 ItemSelectable getItemSelectable()
          Returns the originating object for this event (for example, a CheckboxMenuItem).
 int getStateChange()
          Returns the new state of the item that generated the event (SELECTED or DESELECTED).
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SELECTED

public static final int SELECTED
Indicates that the current state of the subject item is selected.
See Also:
ItemEvent(com.droplets.api.ItemSelectable, java.lang.Object, int), getStateChange()

DESELECTED

public static final int DESELECTED
Indicates that the current state of the subject item is deselected.
See Also:
ItemEvent(com.droplets.api.ItemSelectable, java.lang.Object, int), getStateChange()
Constructor Detail

ItemEvent

public ItemEvent(ItemSelectable source,
                 java.lang.Object item,
                 int stateChange)
Constructs a new ItemEvent object given the following information: a selectable item that generated the event (for example, a CheckboxMenuItem), the item affected by the event (in the case of a CheckboxMenuItem, this is a String that represents its label), and an integer that indicates whether the item was SELECTED or DESELECTED.
Parameters:
source - the selectable item that generated the event.
item - the item affected by the event.
stateChange - whether the item was selected or deselected.
Method Detail

getItem

public java.lang.Object getItem()
Returns the item to which this event pertains. For a CheckboxMenuItem, this method returns the label of the item.
Returns:
java.lang.Object

getItemSelectable

public ItemSelectable getItemSelectable()
Returns the originating object for this event (for example, a CheckboxMenuItem).
Returns:
com.droplets.api.ItemSelectable

getStateChange

public int getStateChange()
Returns the new state of the item that generated the event (SELECTED or DESELECTED).
Returns:
int


Copyright © Droplets, 2001. All Rights Reserved.