FileDocCategorySizeDatePackage
ItemEvent.javaAPI DocAndroid 1.5 API2915Wed May 06 22:41:54 BST 2009java.awt.event

ItemEvent

public class ItemEvent extends AWTEvent
This class is not supported in Android 1.0. It is merely provided to maintain interface compatibility with desktop Java implementations.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
public 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
private Object
item
private int
stateChange
Constructors Summary
public ItemEvent(ItemSelectable source, int id, Object item, int stateChange)


             
        super(source, id);

        this.item = item;
        this.stateChange = stateChange;
    
Methods Summary
public java.lang.ObjectgetItem()

        return item;
    
public java.awt.ItemSelectablegetItemSelectable()

        return (ItemSelectable) source;
    
public intgetStateChange()

        return stateChange;
    
public java.lang.StringparamString()

        /* The format is based on 1.5 release behavior 
         * which can be revealed by the following code:
         * 
         * Checkbox c = new Checkbox("Checkbox", true);
         * ItemEvent e = new ItemEvent(c, ItemEvent.ITEM_STATE_CHANGED, 
         *                             c, ItemEvent.SELECTED);
         * System.out.println(e);
         */

        String stateString = null;

        switch (stateChange) {
        case SELECTED:
            stateString = "SELECTED"; //$NON-NLS-1$
            break;
        case DESELECTED:
            stateString = "DESELECTED"; //$NON-NLS-1$
            break;
        default:
            stateString = "unknown type"; //$NON-NLS-1$
        }

        return ((id == ITEM_STATE_CHANGED ? "ITEM_STATE_CHANGED" : "unknown type") + //$NON-NLS-1$ //$NON-NLS-2$
                ",item=" + item + ",stateChange=" + stateString); //$NON-NLS-1$ //$NON-NLS-2$