1 7 8 package java.awt.event; 9 10 import java.awt.AWTEvent ; 11 import java.awt.Event ; 12 13 39 public class ActionEvent extends AWTEvent { 40 41 45 public static final int SHIFT_MASK = Event.SHIFT_MASK; 46 47 51 public static final int CTRL_MASK = Event.CTRL_MASK; 52 53 57 public static final int META_MASK = Event.META_MASK; 58 59 63 public static final int ALT_MASK = Event.ALT_MASK; 64 65 66 69 public static final int ACTION_FIRST = 1001; 70 71 74 public static final int ACTION_LAST = 1001; 75 76 79 public static final int ACTION_PERFORMED = ACTION_FIRST; 81 90 String actionCommand; 91 92 100 long when; 101 102 111 int modifiers; 112 113 116 private static final long serialVersionUID = -7671078796273832149L; 117 118 134 public ActionEvent(Object source, int id, String command) { 135 this(source, id, command, 0); 136 } 137 138 155 public ActionEvent(Object source, int id, String command, int modifiers) { 156 this(source, id, command, 0, modifiers); 157 } 158 159 180 public ActionEvent(Object source, int id, String command, long when, 181 int modifiers) { 182 super(source, id); 183 this.actionCommand = command; 184 this.when = when; 185 this.modifiers = modifiers; 186 } 187 188 202 public String getActionCommand() { 203 return actionCommand; 204 } 205 206 214 public long getWhen() { 215 return when; 216 } 217 218 223 public int getModifiers() { 224 return modifiers; 225 } 226 227 233 public String paramString() { 234 String typeStr; 235 switch(id) { 236 case ACTION_PERFORMED: 237 typeStr = "ACTION_PERFORMED"; 238 break; 239 default: 240 typeStr = "unknown type"; 241 } 242 return typeStr + ",cmd="+actionCommand+",when="+when+",modifiers="+ 243 KeyEvent.getKeyModifiersText(modifiers); 244 } 245 } 246 | Popular Tags |