src/share/classes/java/awt/AWTEvent.java

Print this page




 280                 public void setBData(AWTEvent ev, byte[] bdata) {
 281                     ev.bdata = bdata;
 282                 }
 283 
 284             });
 285     }
 286 
 287     private static synchronized Field get_InputEvent_CanAccessSystemClipboard() {
 288         if (inputEvent_CanAccessSystemClipboard_Field == null) {
 289             inputEvent_CanAccessSystemClipboard_Field =
 290                 java.security.AccessController.doPrivileged(
 291                     new java.security.PrivilegedAction<Field>() {
 292                             public Field run() {
 293                                 Field field = null;
 294                                 try {
 295                                     field = InputEvent.class.
 296                                         getDeclaredField("canAccessSystemClipboard");
 297                                     field.setAccessible(true);
 298                                     return field;
 299                                 } catch (SecurityException e) {
 300                                     if (log.isLoggable(PlatformLogger.FINE)) {
 301                                         log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got SecurityException ", e);
 302                                     }
 303                                 } catch (NoSuchFieldException e) {
 304                                     if (log.isLoggable(PlatformLogger.FINE)) {
 305                                         log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got NoSuchFieldException ", e);
 306                                     }
 307                                 }
 308                                 return null;
 309                             }
 310                         });
 311         }
 312 
 313         return inputEvent_CanAccessSystemClipboard_Field;
 314     }
 315 
 316     /**
 317      * Initialize JNI field and method IDs for fields that may be
 318      * accessed from C.
 319      */
 320     private static native void initIDs();
 321 
 322     /**
 323      * Constructs an AWTEvent object from the parameters of a 1.0-style event.
 324      * @param event the old-style event


 577         }
 578         return null;
 579     }
 580 
 581     /**
 582      * Copies all private data from this event into that.
 583      * Space is allocated for the copied data that will be
 584      * freed when the that is finalized. Upon completion,
 585      * this event is not changed.
 586      */
 587     void copyPrivateDataInto(AWTEvent that) {
 588         that.bdata = this.bdata;
 589         // Copy canAccessSystemClipboard value from this into that.
 590         if (this instanceof InputEvent && that instanceof InputEvent) {
 591             Field field = get_InputEvent_CanAccessSystemClipboard();
 592             if (field != null) {
 593                 try {
 594                     boolean b = field.getBoolean(this);
 595                     field.setBoolean(that, b);
 596                 } catch(IllegalAccessException e) {
 597                     if (log.isLoggable(PlatformLogger.FINE)) {
 598                         log.fine("AWTEvent.copyPrivateDataInto() got IllegalAccessException ", e);
 599                     }
 600                 }
 601             }
 602         }
 603         that.isSystemGenerated = this.isSystemGenerated;
 604     }
 605 
 606     void dispatched() {
 607         if (this instanceof InputEvent) {
 608             Field field = get_InputEvent_CanAccessSystemClipboard();
 609             if (field != null) {
 610                 try {
 611                     field.setBoolean(this, false);
 612                 } catch(IllegalAccessException e) {
 613                     if (log.isLoggable(PlatformLogger.FINE)) {
 614                         log.fine("AWTEvent.dispatched() got IllegalAccessException ", e);
 615                     }
 616                 }
 617             }
 618         }
 619     }
 620 } // class AWTEvent


 280                 public void setBData(AWTEvent ev, byte[] bdata) {
 281                     ev.bdata = bdata;
 282                 }
 283 
 284             });
 285     }
 286 
 287     private static synchronized Field get_InputEvent_CanAccessSystemClipboard() {
 288         if (inputEvent_CanAccessSystemClipboard_Field == null) {
 289             inputEvent_CanAccessSystemClipboard_Field =
 290                 java.security.AccessController.doPrivileged(
 291                     new java.security.PrivilegedAction<Field>() {
 292                             public Field run() {
 293                                 Field field = null;
 294                                 try {
 295                                     field = InputEvent.class.
 296                                         getDeclaredField("canAccessSystemClipboard");
 297                                     field.setAccessible(true);
 298                                     return field;
 299                                 } catch (SecurityException e) {
 300                                     if (log.isLoggable(PlatformLogger.Level.FINE)) {
 301                                         log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got SecurityException ", e);
 302                                     }
 303                                 } catch (NoSuchFieldException e) {
 304                                     if (log.isLoggable(PlatformLogger.Level.FINE)) {
 305                                         log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got NoSuchFieldException ", e);
 306                                     }
 307                                 }
 308                                 return null;
 309                             }
 310                         });
 311         }
 312 
 313         return inputEvent_CanAccessSystemClipboard_Field;
 314     }
 315 
 316     /**
 317      * Initialize JNI field and method IDs for fields that may be
 318      * accessed from C.
 319      */
 320     private static native void initIDs();
 321 
 322     /**
 323      * Constructs an AWTEvent object from the parameters of a 1.0-style event.
 324      * @param event the old-style event


 577         }
 578         return null;
 579     }
 580 
 581     /**
 582      * Copies all private data from this event into that.
 583      * Space is allocated for the copied data that will be
 584      * freed when the that is finalized. Upon completion,
 585      * this event is not changed.
 586      */
 587     void copyPrivateDataInto(AWTEvent that) {
 588         that.bdata = this.bdata;
 589         // Copy canAccessSystemClipboard value from this into that.
 590         if (this instanceof InputEvent && that instanceof InputEvent) {
 591             Field field = get_InputEvent_CanAccessSystemClipboard();
 592             if (field != null) {
 593                 try {
 594                     boolean b = field.getBoolean(this);
 595                     field.setBoolean(that, b);
 596                 } catch(IllegalAccessException e) {
 597                     if (log.isLoggable(PlatformLogger.Level.FINE)) {
 598                         log.fine("AWTEvent.copyPrivateDataInto() got IllegalAccessException ", e);
 599                     }
 600                 }
 601             }
 602         }
 603         that.isSystemGenerated = this.isSystemGenerated;
 604     }
 605 
 606     void dispatched() {
 607         if (this instanceof InputEvent) {
 608             Field field = get_InputEvent_CanAccessSystemClipboard();
 609             if (field != null) {
 610                 try {
 611                     field.setBoolean(this, false);
 612                 } catch(IllegalAccessException e) {
 613                     if (log.isLoggable(PlatformLogger.Level.FINE)) {
 614                         log.fine("AWTEvent.dispatched() got IllegalAccessException ", e);
 615                     }
 616                 }
 617             }
 618         }
 619     }
 620 } // class AWTEvent