java.awt.event.AWTEventListenerProxy Java Examples

The following examples show how to use java.awt.event.AWTEventListenerProxy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: bug6872503.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #2
Source File: bug6872503.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #3
Source File: bug6872503.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #4
Source File: bug6872503.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #5
Source File: bug6872503.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #6
Source File: bug6872503.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #7
Source File: bug6872503.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #8
Source File: bug6872503.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #9
Source File: bug6872503.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #10
Source File: bug6872503.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #11
Source File: bug6872503.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #12
Source File: bug6872503.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #13
Source File: bug6872503.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #14
Source File: bug6872503.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #15
Source File: bug6872503.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #16
Source File: bug6872503.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #17
Source File: bug6872503.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #18
Source File: bug6872503.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #19
Source File: bug6872503.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #20
Source File: bug6872503.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #21
Source File: bug6872503.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #22
Source File: bug6872503.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #23
Source File: bug6872503.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #24
Source File: bug6872503.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #25
Source File: bug6872503.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isLayerEventControllerAdded() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners()) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController found");
    } else {
        System.out.println("No LayerEventController");
    }
    return ret;
}
 
Example #26
Source File: bug6872503.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean layerEventControllerMaskEquals(long mask) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    AWTEventListener layerEventController = null;
    for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) {
        if (listener instanceof AWTEventListenerProxy) {
            listener = ((AWTEventListenerProxy)listener).getListener();

        }
        if ("LayerEventController".equals(listener.getClass().getSimpleName())) {
            if (layerEventController != null) {
                throw new RuntimeException("Duplicated LayerEventController");
            }
            layerEventController = listener;
        }
    }
    boolean ret = layerEventController != null;
    if (ret) {
        System.out.println("LayerEventController with the correct mask found");
    } else {
        System.out.println("No LayerEventController with the correct mask");
    }
    return ret;
}
 
Example #27
Source File: Toolkit.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static AWTEventListener deProxyAWTEventListener(AWTEventListener l)
{
    AWTEventListener localL = l;

    if (localL == null) {
        return null;
    }
    // if user passed in a AWTEventListenerProxy object, extract
    // the listener
    if (l instanceof AWTEventListenerProxy) {
        localL = ((AWTEventListenerProxy)l).getListener();
    }
    return localL;
}
 
Example #28
Source File: Toolkit.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Returns an array of all the {@code AWTEventListener}s
 * registered on this toolkit which listen to all of the event
 * types specified in the {@code eventMask} argument.
 * If there is a security manager, its {@code checkPermission}
 * method is called with an
 * {@code AWTPermission("listenToAllAWTEvents")} permission.
 * This may result in a SecurityException.
 * Listeners can be returned
 * within {@code AWTEventListenerProxy} objects, which also contain
 * the event mask for the given listener.
 * Note that listener objects
 * added multiple times appear only once in the returned array.
 *
 * @param  eventMask the bitmask of event types to listen for
 * @return all of the {@code AWTEventListener}s registered
 *         on this toolkit for the specified
 *         event types, or an empty array if no such listeners
 *         are currently registered
 * @throws SecurityException
 *        if a security manager exists and its
 *        {@code checkPermission} method doesn't allow the operation.
 * @see      #addAWTEventListener
 * @see      #removeAWTEventListener
 * @see      SecurityManager#checkPermission
 * @see      java.awt.AWTEvent
 * @see      java.awt.AWTPermission
 * @see      java.awt.event.AWTEventListener
 * @see      java.awt.event.AWTEventListenerProxy
 * @since 1.4
 */
public AWTEventListener[] getAWTEventListeners(long eventMask) {
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
    }
    synchronized (this) {
        EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class);

        java.util.List<AWTEventListenerProxy> list = new ArrayList<>(la.length);

        for (int i = 0; i < la.length; i++) {
            SelectiveAWTEventListener sael = (SelectiveAWTEventListener)la[i];
            if ((sael.getEventMask() & eventMask) == eventMask) {
                //AWTEventListener tempL = sael.getListener();
                list.add(new AWTEventListenerProxy(sael.getEventMask(),
                                                   sael.getListener()));
            }
        }
        return list.toArray(new AWTEventListener[0]);
    }
}
 
Example #29
Source File: Toolkit.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Returns an array of all the {@code AWTEventListener}s
 * registered on this toolkit.
 * If there is a security manager, its {@code checkPermission}
 * method is called with an
 * {@code AWTPermission("listenToAllAWTEvents")} permission.
 * This may result in a SecurityException.
 * Listeners can be returned
 * within {@code AWTEventListenerProxy} objects, which also contain
 * the event mask for the given listener.
 * Note that listener objects
 * added multiple times appear only once in the returned array.
 *
 * @return all of the {@code AWTEventListener}s or an empty
 *         array if no listeners are currently registered
 * @throws SecurityException
 *        if a security manager exists and its
 *        {@code checkPermission} method doesn't allow the operation.
 * @see      #addAWTEventListener
 * @see      #removeAWTEventListener
 * @see      SecurityManager#checkPermission
 * @see      java.awt.AWTEvent
 * @see      java.awt.AWTPermission
 * @see      java.awt.event.AWTEventListener
 * @see      java.awt.event.AWTEventListenerProxy
 * @since 1.4
 */
public AWTEventListener[] getAWTEventListeners() {
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
    }
    synchronized (this) {
        EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class);

        AWTEventListener[] ret = new AWTEventListener[la.length];
        for (int i = 0; i < la.length; i++) {
            SelectiveAWTEventListener sael = (SelectiveAWTEventListener)la[i];
            AWTEventListener tempL = sael.getListener();
            //assert tempL is not an AWTEventListenerProxy - we should
            // have weeded them all out
            // don't want to wrap a proxy inside a proxy
            ret[i] = new AWTEventListenerProxy(sael.getEventMask(), tempL);
        }
        return ret;
    }
}