197 |
private final long when; |
private final long when; |
198 |
|
|
199 |
/** |
/** |
200 |
* The modifiers in effect for this event. Package visible for use by |
* The old-style modifiers in effect for this event. Package visible |
201 |
* subclasses. The old style (bitmask 0x3f) should not be mixed with the |
* for use by subclasses. The old style (bitmask 0x3f) should not be |
202 |
* new style (bitmasks 0xffffffc0). |
* mixed with the new style (bitmasks 0xffffffc0). |
203 |
* |
* |
204 |
* @see #getModifiers() |
* @see #getModifiers() |
205 |
* @see MouseEvent |
* @see MouseEvent |
206 |
* @serial the modifier state, stored in the new style |
* @serial the modifier state, stored in the old style |
207 |
*/ |
*/ |
208 |
int modifiers; |
int modifiers; |
209 |
|
|
210 |
/** |
/** |
211 |
|
* The new-style modifiers in effect for this event. Package visible |
212 |
|
* for use by subclasses. The old style (bitmask 0x3f) should not be |
213 |
|
* mixed with the new style (bitmasks 0xffffffc0). |
214 |
|
* |
215 |
|
* @see #getModifiersEx() |
216 |
|
* @see MouseEvent |
217 |
|
* @serial the modifier state, stored in the new style |
218 |
|
*/ |
219 |
|
int modifiersEx; |
220 |
|
|
221 |
|
/** |
222 |
* Initializes a new instance of <code>InputEvent</code> with the specified |
* Initializes a new instance of <code>InputEvent</code> with the specified |
223 |
* source, id, timestamp, and modifiers. Note that an invalid id leads to |
* source, id, timestamp, and modifiers. Note that an invalid id leads to |
224 |
* unspecified results. |
* unspecified results. |
233 |
{ |
{ |
234 |
super(source, id); |
super(source, id); |
235 |
this.when = when; |
this.when = when; |
236 |
this.modifiers = EventModifier.extend(modifiers); |
this.modifiers = modifiers & EventModifier.OLD_MASK; |
237 |
|
this.modifiersEx = modifiers & EventModifier.NEW_MASK; |
238 |
} |
} |
239 |
|
|
240 |
/** |
/** |
244 |
*/ |
*/ |
245 |
public boolean isShiftDown() |
public boolean isShiftDown() |
246 |
{ |
{ |
247 |
return (modifiers & SHIFT_DOWN_MASK) != 0; |
return ((modifiers & SHIFT_MASK) != 0) |
248 |
|
|| ((modifiersEx & SHIFT_DOWN_MASK) != 0); |
249 |
} |
} |
250 |
|
|
251 |
/** |
/** |
256 |
*/ |
*/ |
257 |
public boolean isControlDown() |
public boolean isControlDown() |
258 |
{ |
{ |
259 |
return (modifiers & CTRL_DOWN_MASK) != 0; |
return ((modifiers & CTRL_MASK) != 0) |
260 |
|
|| ((modifiersEx & CTRL_DOWN_MASK) != 0); |
261 |
} |
} |
262 |
|
|
263 |
/** |
/** |
267 |
*/ |
*/ |
268 |
public boolean isMetaDown() |
public boolean isMetaDown() |
269 |
{ |
{ |
270 |
return (modifiers & META_DOWN_MASK) != 0; |
return ((modifiers & META_MASK) != 0) |
271 |
|
|| ((modifiersEx & META_DOWN_MASK) != 0); |
272 |
} |
} |
273 |
|
|
274 |
/** |
/** |
278 |
*/ |
*/ |
279 |
public boolean isAltDown() |
public boolean isAltDown() |
280 |
{ |
{ |
281 |
return (modifiers & ALT_DOWN_MASK) != 0; |
return ((modifiers & ALT_MASK) != 0) |
282 |
|
|| ((modifiersEx & ALT_DOWN_MASK) != 0); |
283 |
} |
} |
284 |
|
|
285 |
/** |
/** |
290 |
*/ |
*/ |
291 |
public boolean isAltGraphDown() |
public boolean isAltGraphDown() |
292 |
{ |
{ |
293 |
return (modifiers & ALT_GRAPH_DOWN_MASK) != 0; |
return ((modifiers & ALT_GRAPH_MASK) != 0) |
294 |
|
|| ((modifiersEx & ALT_GRAPH_DOWN_MASK) != 0); |
295 |
} |
} |
296 |
|
|
297 |
/** |
/** |
317 |
*/ |
*/ |
318 |
public int getModifiers() |
public int getModifiers() |
319 |
{ |
{ |
320 |
return EventModifier.revert(modifiers); |
return modifiers; |
321 |
} |
} |
322 |
|
|
323 |
/** |
/** |
338 |
*/ |
*/ |
339 |
public int getModifiersEx() |
public int getModifiersEx() |
340 |
{ |
{ |
341 |
return modifiers; |
return modifiersEx; |
342 |
} |
} |
343 |
|
|
344 |
/** |
/** |