336 * @see #getWhen()
337 * @see #getModifiers()
338 */
339 InputEvent(Component source, int id, long when, int modifiers) {
340 super(source, id);
341 this.when = when;
342 this.modifiers = modifiers;
343 canAccessSystemClipboard = canAccessSystemClipboard();
344 }
345
346 private boolean canAccessSystemClipboard() {
347 boolean b = false;
348
349 if (!GraphicsEnvironment.isHeadless()) {
350 SecurityManager sm = System.getSecurityManager();
351 if (sm != null) {
352 try {
353 sm.checkSystemClipboardAccess();
354 b = true;
355 } catch (SecurityException se) {
356 if (logger.isLoggable(PlatformLogger.FINE)) {
357 logger.fine("InputEvent.canAccessSystemClipboard() got SecurityException ", se);
358 }
359 }
360 } else {
361 b = true;
362 }
363 }
364
365 return b;
366 }
367
368 /**
369 * Returns whether or not the Shift modifier is down on this event.
370 */
371 public boolean isShiftDown() {
372 return (modifiers & SHIFT_MASK) != 0;
373 }
374
375 /**
376 * Returns whether or not the Control modifier is down on this event.
|
336 * @see #getWhen()
337 * @see #getModifiers()
338 */
339 InputEvent(Component source, int id, long when, int modifiers) {
340 super(source, id);
341 this.when = when;
342 this.modifiers = modifiers;
343 canAccessSystemClipboard = canAccessSystemClipboard();
344 }
345
346 private boolean canAccessSystemClipboard() {
347 boolean b = false;
348
349 if (!GraphicsEnvironment.isHeadless()) {
350 SecurityManager sm = System.getSecurityManager();
351 if (sm != null) {
352 try {
353 sm.checkSystemClipboardAccess();
354 b = true;
355 } catch (SecurityException se) {
356 if (logger.isLoggable(PlatformLogger.Level.FINE)) {
357 logger.fine("InputEvent.canAccessSystemClipboard() got SecurityException ", se);
358 }
359 }
360 } else {
361 b = true;
362 }
363 }
364
365 return b;
366 }
367
368 /**
369 * Returns whether or not the Shift modifier is down on this event.
370 */
371 public boolean isShiftDown() {
372 return (modifiers & SHIFT_MASK) != 0;
373 }
374
375 /**
376 * Returns whether or not the Control modifier is down on this event.
|