java.awt.event.ItemEvent Maven / Gradle / Ivy
/*
NOTICE
(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
Neither this file nor any files generated from it describe a complete
specification, and they may only be used as described below. For
example, no permission is given for you to incorporate this file, in
whole or in part, in an implementation of a Java specification.
Sun Microsystems Inc. owns the copyright in this file and it is provided
to you for informative, as opposed to normative, use. The file and any
files generated from it may be used to generate other informative
documentation, such as a unified set of documents of API signatures for
a platform that includes technologies expressed as Java APIs. The file
may also be used to produce "compilation stubs," which allow
applications to be compiled and validated for such platforms.
Any work generated from this file, such as unified javadocs or compiled
stub files, must be accompanied by this notice in its entirety.
This work corresponds to the API signatures of JSR 217: Personal Basis
Profile 1.1. In the event of a discrepency between this work and the
JSR 217 specification, which is available at
http://www.jcp.org/en/jsr/detail?id=217, the latter takes precedence.
*/
package java.awt.event;
import java.awt.Component;
import java.awt.AWTEvent;
// import java.awt.Event;
import java.awt.ItemSelectable;
/**
* 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".
*
* @version 1.26 01/23/03
* @author Carl Quinn
*
* @see java.awt.ItemSelectable
* @see ItemListener
* @see Tutorial: Writing an Item Listener
* @see Reference: The Java Class Libraries (update file)
*
* @since 1.1
*/
public class ItemEvent extends AWTEvent
{
/**
* The first number in the range of ids used for item events.
*/
public static final int ITEM_FIRST = 701;
/**
* The last number in the range of ids used for item events.
*/
public static final int ITEM_LAST = 701;
/**
* This event id indicates that an item's state changed.
*/
public static final int ITEM_STATE_CHANGED = ITEM_FIRST;
/**
* This state-change value indicates that an item was selected.
*/
public static final int SELECTED = 1;
/**
* This state-change-value indicates that a selected item was deselected.
*/
public static final int DESELECTED = 2;
/**
* The item whose selection state has changed.
*
* @serial
* @see #getItem()
*/
Object item;
/**
* stateChange
indicates whether the item
* was selected or deselected.
*
* @serial
* @see #getStateChange()
*/
int stateChange;
/*
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = -608708132447206933L;
/**
* Constructs an ItemEvent
object.
*
Note that passing in an invalid id
results in
* unspecified behavior.
*
* @param source the ItemSelectable
object
* that originated the event
* @param id an integer that identifies the event type
* @param item an object -- the item affected by the event
* @param stateChange
* an integer that indicates whether the item was
* selected or deselected
*/
public ItemEvent(ItemSelectable source, int id, Object item, int
stateChange)
{ super(null, 0); }
/**
* Returns the originator of the event.
*
* @return the ItemSelectable object that originated the event.
*/
public ItemSelectable getItemSelectable() { return null; }
/**
* Returns the item affected by the event.
*
* @return the item (object) that was affected by the event
*/
public Object getItem() {return null; }
/**
* Returns the type of state change (selected or deselected).
*
* @return an integer that indicates whether the item was selected
* or deselected
*
* @see #SELECTED
* @see #DESELECTED
*/
public int getStateChange() { return 0; }
/**
* Returns a parameter string identifying this item event.
* This method is useful for event-logging and for debugging.
*
* @return a string identifying the event and its attributes
*/
public String paramString() {return null; }
}