1 /*
2 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
651 if (q.event.getID() == id) {
652 return q.event;
653 }
654 }
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 border=1 summary="Event types, source types, and dispatch methods">
672 * <tr>
673 * <th>Event Type</th>
674 * <th>Source Type</th>
675 * <th>Dispatched To</th>
676 * </tr>
677 * <tr>
678 * <td>ActiveEvent</td>
679 * <td>Any</td>
680 * <td>event.dispatch()</td>
681 * </tr>
682 * <tr>
683 * <td>Other</td>
684 * <td>Component</td>
685 * <td>source.dispatchEvent(AWTEvent)</td>
686 * </tr>
687 * <tr>
688 * <td>Other</td>
689 * <td>MenuComponent</td>
690 * <td>source.dispatchEvent(AWTEvent)</td>
691 * </tr>
692 * <tr>
693 * <td>Other</td>
694 * <td>Other</td>
695 * <td>No action (ignored)</td>
696 * </tr>
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
716 public void run() {
|
1 /*
2 * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
651 if (q.event.getID() == id) {
652 return q.event;
653 }
654 }
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
721 public void run() {
|