< prev index next >

src/java.desktop/share/classes/java/awt/EventQueue.java

Print this page




 655             }
 656         } finally {
 657             pushPopLock.unlock();
 658         }
 659 
 660         return null;
 661     }
 662 
 663     private static final JavaSecurityAccess javaSecurityAccess =
 664         SharedSecrets.getJavaSecurityAccess();
 665 
 666     /**
 667      * Dispatches an event. The manner in which the event is
 668      * dispatched depends upon the type of the event and the
 669      * type of the event's source object:
 670      *
 671      * <table class="striped">
 672      * <caption>Event types, source types, and dispatch methods</caption>
 673      * <thead>
 674      * <tr>
 675      *     <th>Event Type</th>
 676      *     <th>Source Type</th>
 677      *     <th>Dispatched To</th>
 678      * </tr>
 679      * </thead>
 680      * <tbody>
 681      * <tr>
 682      *     <td>ActiveEvent</td>
 683      *     <td>Any</td>
 684      *     <td>event.dispatch()</td>
 685      * </tr>
 686      * <tr>
 687      *     <td>Other</td>
 688      *     <td>Component</td>
 689      *     <td>source.dispatchEvent(AWTEvent)</td>
 690      * </tr>
 691      * <tr>
 692      *     <td>Other</td>
 693      *     <td>MenuComponent</td>
 694      *     <td>source.dispatchEvent(AWTEvent)</td>
 695      * </tr>
 696      * <tr>
 697      *     <td>Other</td>
 698      *     <td>Other</td>
 699      *     <td>No action (ignored)</td>
 700      * </tr>
 701      * </tbody>
 702      * </table>
 703      *
 704      * @param event an instance of {@code java.awt.AWTEvent},
 705      *          or a subclass of it
 706      * @throws NullPointerException if {@code event} is {@code null}
 707      * @since           1.2
 708      */
 709     protected void dispatchEvent(final AWTEvent event) {
 710         final Object src = event.getSource();
 711         final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
 712             public Void run() {
 713                 // In case fwDispatcher is installed and we're already on the
 714                 // dispatch thread (e.g. performing DefaultKeyboardFocusManager.sendMessage),
 715                 // dispatch the event straight away.
 716                 if (fwDispatcher == null || isDispatchThreadImpl()) {
 717                     dispatchEventImpl(event, src);
 718                 } else {
 719                     fwDispatcher.scheduleDispatch(new Runnable() {
 720                         @Override




 655             }
 656         } finally {
 657             pushPopLock.unlock();
 658         }
 659 
 660         return null;
 661     }
 662 
 663     private static final JavaSecurityAccess javaSecurityAccess =
 664         SharedSecrets.getJavaSecurityAccess();
 665 
 666     /**
 667      * Dispatches an event. The manner in which the event is
 668      * dispatched depends upon the type of the event and the
 669      * type of the event's source object:
 670      *
 671      * <table class="striped">
 672      * <caption>Event types, source types, and dispatch methods</caption>
 673      * <thead>
 674      *   <tr>
 675      *     <th scope="col">Event Type
 676      *     <th scope="col">Source Type
 677      *     <th scope="col">Dispatched To

 678      * </thead>
 679      * <tbody>
 680      *   <tr>
 681      *     <th scope="row">ActiveEvent
 682      *     <td>Any
 683      *     <td>event.dispatch()

 684      *   <tr>
 685      *     <th scope="row">Other
 686      *     <td>Component
 687      *     <td>source.dispatchEvent(AWTEvent)

 688      *   <tr>
 689      *     <th scope="row">Other
 690      *     <td>MenuComponent
 691      *     <td>source.dispatchEvent(AWTEvent)

 692      *   <tr>
 693      *     <th scope="row">Other
 694      *     <td>Other
 695      *     <td>No action (ignored)

 696      * </tbody>
 697      * </table>
 698      *
 699      * @param event an instance of {@code java.awt.AWTEvent},
 700      *          or a subclass of it
 701      * @throws NullPointerException if {@code event} is {@code null}
 702      * @since           1.2
 703      */
 704     protected void dispatchEvent(final AWTEvent event) {
 705         final Object src = event.getSource();
 706         final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
 707             public Void run() {
 708                 // In case fwDispatcher is installed and we're already on the
 709                 // dispatch thread (e.g. performing DefaultKeyboardFocusManager.sendMessage),
 710                 // dispatch the event straight away.
 711                 if (fwDispatcher == null || isDispatchThreadImpl()) {
 712                     dispatchEventImpl(event, src);
 713                 } else {
 714                     fwDispatcher.scheduleDispatch(new Runnable() {
 715                         @Override


< prev index next >