Java 类java.awt.event.AWTEventListenerProxy 实例源码

项目:jdk8u-jdk    文件:bug6872503.java   
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;
}
项目:jdk8u-jdk    文件:bug6872503.java   
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;
}
项目:openjdk-jdk10    文件:bug6872503.java   
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;
}
项目:openjdk-jdk10    文件:bug6872503.java   
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;
}
项目:openjdk9    文件:bug6872503.java   
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;
}
项目:openjdk9    文件:bug6872503.java   
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;
}
项目:jdk8u_jdk    文件:bug6872503.java   
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;
}
项目:jdk8u_jdk    文件:bug6872503.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6872503.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6872503.java   
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;
}
项目:infobip-open-jdk-8    文件:bug6872503.java   
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;
}
项目:infobip-open-jdk-8    文件:bug6872503.java   
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;
}
项目:jdk8u-dev-jdk    文件:bug6872503.java   
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;
}
项目:jdk8u-dev-jdk    文件:bug6872503.java   
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;
}
项目:jdk7-jdk    文件:bug6872503.java   
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;
}
项目:jdk7-jdk    文件:bug6872503.java   
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;
}
项目:openjdk-source-code-learn    文件:bug6872503.java   
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;
}
项目:openjdk-source-code-learn    文件:bug6872503.java   
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;
}
项目:OLD-OpenJDK8    文件:bug6872503.java   
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;
}
项目:OLD-OpenJDK8    文件:bug6872503.java   
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;
}
项目:JAVA_UNIT    文件:bug6872503.java   
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;
}
项目:JAVA_UNIT    文件:bug6872503.java   
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;
}
项目:openjdk-jdk7u-jdk    文件:bug6872503.java   
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;
}
项目:openjdk-jdk7u-jdk    文件:bug6872503.java   
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;
}
项目:openjdk-icedtea7    文件:bug6872503.java   
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;
}
项目:openjdk-icedtea7    文件:bug6872503.java   
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;
}
项目:javify    文件:Toolkit.java   
/**
 * Removes an AWT event listener from this toolkit. This listener is no
 * longer informed of any event types it was registered in.
 *
 * If a security manager is installed, it is asked first if an
 * <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code> is allowed.
 * This may result in a <code>SecurityException</code> beeing thrown.
 *
 * It is not recommended to use this kind of notification for normal
 * applications. It is intended solely for the purpose of debugging and to
 * support special facilities.
 *
 * @param listener the listener to remove
 *
 * @throws SecurityException if there is a <code>SecurityManager</code> that
 *         doesn't grant
 *         <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code>
 *
 * @since 1.2
 *
 * @see #addAWTEventListener(AWTEventListener, long)
 * @see #getAWTEventListeners()
 * @see #getAWTEventListeners(long)
 */
public void removeAWTEventListener(AWTEventListener listener)
{
  // First we must check the security permissions.
  SecurityManager s = System.getSecurityManager();
  if (s != null)
    s.checkPermission(new AWTPermission("listenToAllAWTEvents"));


  // Find the index of the listener.
  int index = -1;
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if (proxy.getListener() == listener)
        {
          index = i;
          break;
        }
    }

  // Copy over the arrays and leave out the removed element.
  if (index != -1)
    {
      AWTEventListenerProxy[] newArray =
        new AWTEventListenerProxy[awtEventListeners.length - 1];
      if (index > 0)
        System.arraycopy(awtEventListeners, 0, newArray, 0, index);
      if (index < awtEventListeners.length - 1)
        System.arraycopy(awtEventListeners, index + 1, newArray, index,
                         awtEventListeners.length - index - 1);
      awtEventListeners = newArray;
    }
}
项目:javify    文件:Toolkit.java   
/**
 * Dispatches events to listeners registered to this Toolkit. This is called
 * by {@link Component#dispatchEventImpl(AWTEvent)} in order to dispatch
 * events globally.
 *
 * @param ev the event to dispatch
 */
void globalDispatchEvent(AWTEvent ev)
{
  // We do not use the accessor methods here because they create new
  // arrays each time. We must be very efficient, so we access this directly.
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if ((proxy.getEventMask() & AWTEvent.eventIdToMask(ev.getID())) != 0)
        proxy.eventDispatched(ev);
    }
}
项目:jvm-stm    文件:Toolkit.java   
/**
 * Removes an AWT event listener from this toolkit. This listener is no
 * longer informed of any event types it was registered in.
 *
 * If a security manager is installed, it is asked first if an
 * <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code> is allowed.
 * This may result in a <code>SecurityException</code> beeing thrown.
 *
 * It is not recommended to use this kind of notification for normal
 * applications. It is intended solely for the purpose of debugging and to
 * support special facilities.
 *
 * @param listener the listener to remove
 *
 * @throws SecurityException if there is a <code>SecurityManager</code> that
 *         doesn't grant
 *         <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code>
 *
 * @since 1.2
 *
 * @see #addAWTEventListener(AWTEventListener, long)
 * @see #getAWTEventListeners()
 * @see #getAWTEventListeners(long)
 */
public void removeAWTEventListener(AWTEventListener listener)
{
  // First we must check the security permissions.
  SecurityManager s = System.getSecurityManager();
  if (s != null)
    s.checkPermission(new AWTPermission("listenToAllAWTEvents"));


  // Find the index of the listener.
  int index = -1;
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if (proxy.getListener() == listener)
        {
          index = i;
          break;
        }
    }

  // Copy over the arrays and leave out the removed element.
  if (index != -1)
    {
      AWTEventListenerProxy[] newArray =
        new AWTEventListenerProxy[awtEventListeners.length - 1];
      if (index > 0)
        System.arraycopy(awtEventListeners, 0, newArray, 0, index);
      if (index < awtEventListeners.length - 1)
        System.arraycopy(awtEventListeners, index + 1, newArray, index,
                         awtEventListeners.length - index - 1);
      awtEventListeners = newArray;
    }
}
项目:jvm-stm    文件:Toolkit.java   
/**
 * Dispatches events to listeners registered to this Toolkit. This is called
 * by {@link Component#dispatchEventImpl(AWTEvent)} in order to dispatch
 * events globally.
 *
 * @param ev the event to dispatch
 */
void globalDispatchEvent(AWTEvent ev)
{
  // We do not use the accessor methods here because they create new
  // arrays each time. We must be very efficient, so we access this directly.
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if ((proxy.getEventMask() & AWTEvent.eventIdToMask(ev.getID())) != 0)
        proxy.eventDispatched(ev);
    }
}
项目:cn1    文件:Toolkit.java   
void removeAWTEventListener(AWTEventListener listener) {
    if (listener != null) {
        for (AWTEventListenerProxy proxy : listeners.getUserListeners()) {
            if (listener == proxy.getListener()) {
                listeners.removeUserListener(proxy);
                return;
            }
        }
    }
}
项目:cn1    文件:Toolkit.java   
AWTEventListener[] getAWTEventListeners() {
    HashSet<EventListener> listenersSet = new HashSet<EventListener>();
    for (AWTEventListenerProxy proxy : listeners.getUserListeners()) {
        listenersSet.add(proxy.getListener());
    }
    return listenersSet.toArray(new AWTEventListener[listenersSet.size()]);
}
项目:cn1    文件:Toolkit.java   
AWTEventListener[] getAWTEventListeners(long eventMask) {
    HashSet<EventListener> listenersSet = new HashSet<EventListener>();
    for (AWTEventListenerProxy proxy : listeners.getUserListeners()) {
        if ((proxy.getEventMask() & eventMask) == eventMask) {
            listenersSet.add(proxy.getListener());
        }
    }
    return listenersSet.toArray(new AWTEventListener[listenersSet.size()]);
}
项目:cn1    文件:Toolkit.java   
void dispatchAWTEvent(AWTEvent event) {
    AWTEvent.EventDescriptor descriptor = eventTypeLookup.getEventDescriptor(event);
    if (descriptor == null) {
        return;
    }
    for (AWTEventListenerProxy proxy : listeners.getUserListeners()) {
        if ((proxy.getEventMask() & descriptor.eventMask) != 0) {
            proxy.eventDispatched(event);
        }
    }
}
项目:JamVM-PH    文件:Toolkit.java   
/**
 * Removes an AWT event listener from this toolkit. This listener is no
 * longer informed of any event types it was registered in.
 *
 * If a security manager is installed, it is asked first if an
 * <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code> is allowed.
 * This may result in a <code>SecurityException</code> beeing thrown.
 *
 * It is not recommended to use this kind of notification for normal
 * applications. It is intended solely for the purpose of debugging and to
 * support special facilities.
 *
 * @param listener the listener to remove
 *
 * @throws SecurityException if there is a <code>SecurityManager</code> that
 *         doesn't grant
 *         <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code>
 *
 * @since 1.2
 *
 * @see #addAWTEventListener(AWTEventListener, long)
 * @see #getAWTEventListeners()
 * @see #getAWTEventListeners(long)
 */
public void removeAWTEventListener(AWTEventListener listener)
{
  // First we must check the security permissions.
  SecurityManager s = System.getSecurityManager();
  if (s != null)
    s.checkPermission(new AWTPermission("listenToAllAWTEvents"));


  // Find the index of the listener.
  int index = -1;
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if (proxy.getListener() == listener)
        {
          index = i;
          break;
        }
    }

  // Copy over the arrays and leave out the removed element.
  if (index != -1)
    {
      AWTEventListenerProxy[] newArray =
        new AWTEventListenerProxy[awtEventListeners.length - 1];
      if (index > 0)
        System.arraycopy(awtEventListeners, 0, newArray, 0, index);
      if (index < awtEventListeners.length - 1)
        System.arraycopy(awtEventListeners, index + 1, newArray, index,
                         awtEventListeners.length - index - 1);
      awtEventListeners = newArray;
    }
}
项目:JamVM-PH    文件:Toolkit.java   
/**
 * Dispatches events to listeners registered to this Toolkit. This is called
 * by {@link Component#dispatchEventImpl(AWTEvent)} in order to dispatch
 * events globally.
 *
 * @param ev the event to dispatch
 */
void globalDispatchEvent(AWTEvent ev)
{
  // We do not use the accessor methods here because they create new
  // arrays each time. We must be very efficient, so we access this directly.
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if ((proxy.getEventMask() & AWTEvent.eventIdToMask(ev.getID())) != 0)
        proxy.eventDispatched(ev);
    }
}
项目:classpath    文件:Toolkit.java   
/**
 * Removes an AWT event listener from this toolkit. This listener is no
 * longer informed of any event types it was registered in.
 *
 * If a security manager is installed, it is asked first if an
 * <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code> is allowed.
 * This may result in a <code>SecurityException</code> beeing thrown.
 *
 * It is not recommended to use this kind of notification for normal
 * applications. It is intended solely for the purpose of debugging and to
 * support special facilities.
 *
 * @param listener the listener to remove
 *
 * @throws SecurityException if there is a <code>SecurityManager</code> that
 *         doesn't grant
 *         <code>AWTPermission(&quot;listenToAllAWTEvents&quot;)</code>
 *
 * @since 1.2
 *
 * @see #addAWTEventListener(AWTEventListener, long)
 * @see #getAWTEventListeners()
 * @see #getAWTEventListeners(long)
 */
public void removeAWTEventListener(AWTEventListener listener)
{
  // First we must check the security permissions.
  SecurityManager s = System.getSecurityManager();
  if (s != null)
    s.checkPermission(new AWTPermission("listenToAllAWTEvents"));


  // Find the index of the listener.
  int index = -1;
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if (proxy.getListener() == listener)
        {
          index = i;
          break;
        }
    }

  // Copy over the arrays and leave out the removed element.
  if (index != -1)
    {
      AWTEventListenerProxy[] newArray =
        new AWTEventListenerProxy[awtEventListeners.length - 1];
      if (index > 0)
        System.arraycopy(awtEventListeners, 0, newArray, 0, index);
      if (index < awtEventListeners.length - 1)
        System.arraycopy(awtEventListeners, index + 1, newArray, index,
                         awtEventListeners.length - index - 1);
      awtEventListeners = newArray;
    }
}
项目:classpath    文件:Toolkit.java   
/**
 * Dispatches events to listeners registered to this Toolkit. This is called
 * by {@link Component#dispatchEventImpl(AWTEvent)} in order to dispatch
 * events globally.
 *
 * @param ev the event to dispatch
 */
void globalDispatchEvent(AWTEvent ev)
{
  // We do not use the accessor methods here because they create new
  // arrays each time. We must be very efficient, so we access this directly.
  for (int i = 0; i < awtEventListeners.length; ++i)
    {
      AWTEventListenerProxy proxy = awtEventListeners[i];
      if ((proxy.getEventMask() & AWTEvent.eventIdToMask(ev.getID())) != 0)
        proxy.eventDispatched(ev);
    }
}
项目:freeVM    文件:Toolkit.java   
void removeAWTEventListener(AWTEventListener listener) {
    if (listener != null) {
        for (AWTEventListenerProxy proxy : listeners.getUserListeners()) {
            if (listener == proxy.getListener()) {
                listeners.removeUserListener(proxy);
                return;
            }
        }
    }
}
项目:freeVM    文件:Toolkit.java   
AWTEventListener[] getAWTEventListeners() {
    HashSet<EventListener> listenersSet = new HashSet<EventListener>();
    for (AWTEventListenerProxy proxy : listeners.getUserListeners()) {
        listenersSet.add(proxy.getListener());
    }
    return listenersSet.toArray(new AWTEventListener[listenersSet.size()]);
}