1 7 8 package java.awt.event; 9 10 import java.awt.Component ; 11 import java.awt.AWTEvent ; 12 import java.awt.Event ; 13 import java.awt.ItemSelectable ; 14 15 39 public class ItemEvent extends AWTEvent { 40 41 44 public static final int ITEM_FIRST = 701; 45 46 49 public static final int ITEM_LAST = 701; 50 51 54 public static final int ITEM_STATE_CHANGED = ITEM_FIRST; 56 59 public static final int SELECTED = 1; 60 61 64 public static final int DESELECTED = 2; 65 66 72 Object item; 73 74 81 int stateChange; 82 83 86 private static final long serialVersionUID = -608708132447206933L; 87 88 104 public ItemEvent(ItemSelectable source, int id, Object item, int stateChange) { 105 super(source, id); 106 this.item = item; 107 this.stateChange = stateChange; 108 } 109 110 115 public ItemSelectable getItemSelectable() { 116 return (ItemSelectable )source; 117 } 118 119 124 public Object getItem() { 125 return item; 126 } 127 128 137 public int getStateChange() { 138 return stateChange; 139 } 140 141 147 public String paramString() { 148 String typeStr; 149 switch(id) { 150 case ITEM_STATE_CHANGED: 151 typeStr = "ITEM_STATE_CHANGED"; 152 break; 153 default: 154 typeStr = "unknown type"; 155 } 156 157 String stateStr; 158 switch(stateChange) { 159 case SELECTED: 160 stateStr = "SELECTED"; 161 break; 162 case DESELECTED: 163 stateStr = "DESELECTED"; 164 break; 165 default: 166 stateStr = "unknown type"; 167 } 168 return typeStr + ",item="+item + ",stateChange="+stateStr; 169 } 170 171 } 172 | Popular Tags |