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

项目:marathonv5    文件:EventQueueDeviceKBTest.java   
@Override public void whetherMenusAreAccessible() throws Throwable {
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        @Override public void eventDispatched(AWTEvent event) {
            System.err.println(event);
        }
    }, AWTEvent.KEY_EVENT_MASK);
    if (Platform.getCurrent() == Platform.MAC && System.getProperty("java.version", "").matches("1.[78].*")) {
        throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+");
    }
    exitItemCalled = false;
    driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f"));
    new WaitWithoutException("Waiting for exit item to be shown") {
        @Override public boolean until() {
            return exitItem.isShowing();
        }
    };
    driver.click(exitItem, Buttons.LEFT, 1, 0, 0);
    new WaitWithoutException("Waiting for exit item to be called") {
        @Override public boolean until() {
            return exitItemCalled;
        }
    };
    AssertJUnit.assertEquals(true, exitItemCalled);
}
项目: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;
}
项目:pumpernickel    文件:GraphicsWriterDebugger.java   
/** Install a debugging hotkey.  When that key is pressed: a new
 * <code>GraphicsWriterDebugger</code> frame will appear that paints
 * the argument.
 * 
 * @param component a component to debug.  The <code>paint()</code> method
 * of this argument will be used.
 * @param keyCode a <code>KeyEven.VK_X</code> key code.  When this key is
 * pressed, the <code>GraphicsWriterDebugger</code> frame will be created.
 */
public static void installDebugHotkey(final Component component,final int keyCode) {
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

        public void eventDispatched(AWTEvent event) {
            KeyEvent e = (KeyEvent)event;
            if(e.getKeyCode()==keyCode && e.getID()==KeyEvent.KEY_PRESSED) {
                GraphicsWriter writer = new GraphicsWriter(true);
                component.paint(writer);
                GraphicsWriterDebugger d = new GraphicsWriterDebugger(writer);
                d.pack();
                d.setVisible(true);
            }
        }

    }, AWTEvent.KEY_EVENT_MASK);
}
项目: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;
}
项目:intellij-ce-playground    文件:MacUtil.java   
public static void adjustFocusTraversal(@NotNull Disposable disposable) {
  if (!SystemInfo.isMacOSSnowLeopard) return;
  final AWTEventListener listener = new AWTEventListener() {
    @Override
    public void eventDispatched(AWTEvent event) {
      if (event instanceof KeyEvent
          && ((KeyEvent)event).getKeyCode() == KeyEvent.VK_TAB
          && (!(event.getSource() instanceof JTextComponent))
          && (!(event.getSource() instanceof JList))
          && !isFullKeyboardAccessEnabled())
        ((KeyEvent)event).consume();
    }
  };
  Disposer.register(disposable, new Disposable() {
    @Override
    public void dispose() {
      Toolkit.getDefaultToolkit().removeAWTEventListener(listener);
    }
  });
  Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
}
项目:binnavi    文件:CHelpManager.java   
/**
 * Creates a new help manager object.
 */
private CHelpManager()
{
    final Image cursorImage = Toolkit.getDefaultToolkit().getImage(CMain.class.getResource("data/help.png"));
    final java.awt.Point cursorHotSpot = new java.awt.Point(0,0);
    m_helpCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImage, cursorHotSpot, "helpCursor");

    Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener()
    {
        @Override
        public void eventDispatched(final AWTEvent event)
        {
            handleEvent(event);
        }
    },
    AWTEvent.MOUSE_EVENT_MASK);
}
项目:chatty    文件:ActivityTracker.java   
/**
 * Start tracking activity (globally currently only mouse activity, inside
 * of the program keypresses and mouse actions).
 */
public static void startTracking() {
    if (timer == null) {
        checkMouseLocation();
        timer = new Timer(DELAY, new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                checkMouseLocation();
            }
        });
        timer.start();
        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            @Override
            public void eventDispatched(AWTEvent event) {
                triggerActivity();
            }
        }, AWTEvent.KEY_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK);
        LOGGER.info("Started tracking user activity..");
    }
}
项目:pegasia    文件:ScreenShotPlugin.java   
public static void start() {
    if (properties == null)
        properties = new ScreenShotProperties();

    listener = new AWTEventListener() {
        @Override
        public void eventDispatched(AWTEvent event) {
            if (active && properties.useHotkey &&
                    ((KeyEvent)event).getKeyCode() == KeyEvent.VK_PRINTSCREEN &&
                    event.getID() == KeyEvent.KEY_RELEASED ) {
                takeScreenshot(ScreenshotType.GAME);
                ((KeyEvent)event).consume();
            }
        }
    };

    Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
    active = true;
}
项目:SmartTokens    文件:GUIUtils.java   
public static void activateKeyStates() {
    if (keyStates == null)
        keyStates = new AdvancedKeyListenerFilter(null,  false);
    // add a global listener
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        public void eventDispatched(AWTEvent e) {
            if (e instanceof KeyEvent) {
                switch (e.getID()) {
                case KeyEvent.KEY_PRESSED:
                    keyStates.keyPressed((KeyEvent)e);
                    break;
                case KeyEvent.KEY_RELEASED:
                    keyStates.keyReleased((KeyEvent)e);
                    break;
                case KeyEvent.KEY_TYPED:
                    keyStates.keyTyped((KeyEvent)e);
                    break;
                }
            }
        }
    }, AWTEvent.KEY_EVENT_MASK);
}
项目:javamelody    文件:MainFrame.java   
private void initActivityMonitor() {
    lastActivity = System.currentTimeMillis();
    final AWTEventListener awtEventListener = new AWTEventListener() {
        /** {@inheritDoc} */
        @Override
        public void eventDispatched(AWTEvent event) {
            lastActivity = System.currentTimeMillis();
        }
    };
    Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener,
            AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK
                    | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
    final Timer activityMonitorTimer = new Timer("ActivityMonitorTimer", true);
    final TimerTask timerTask = new TimerTask() {
        /** {@inheritDoc} */
        @Override
        public void run() {
            if (System.currentTimeMillis() - lastActivity > INACTIVITY_DELAY * 60L * 1000) {
                exit(1);
            }
        }
    };
    // on vérifie l'activité utilisateur toutes les 60 secondes par rapport au délai maximum d'inactivité
    activityMonitorTimer.schedule(timerTask, 60L * 1000, 60L * 1000);
}
项目:Chatty-Twitch-Client    文件:ActivityTracker.java   
/**
 * Start tracking activity (globally currently only mouse activity, inside
 * of the program keypresses and mouse actions).
 */
public static void startTracking() {
    if (timer == null) {
        checkMouseLocation();
        timer = new Timer(DELAY, new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                checkMouseLocation();
            }
        });
        timer.start();
        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            @Override
            public void eventDispatched(AWTEvent event) {
                triggerActivity();
            }
        }, AWTEvent.KEY_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK);
        LOGGER.info("Started tracking user activity..");
    }
}
项目: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;
}
项目:openimaj    文件:VideoProcessingDemo.java   
private void addVideoFileListeners() {
    final long eventMask = AWTEvent.KEY_EVENT_MASK;
    final NumberKeySeekListener keyEventListener = new NumberKeySeekListener(this.videoDisplay);
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        @Override
        public void eventDispatched(final AWTEvent event) {
            switch (event.getID()) {
            case KeyEvent.KEY_PRESSED:
                final KeyEvent kevent = (KeyEvent) event;
                keyEventListener.keyPressed(kevent);
                break;
            };
        }
    }, eventMask);
    //      rp.addKeyListener(new NumberKeySeekListener(videoDisplay));
}
项目: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;
}
项目:selenium-utils    文件:ScreenRecorder.java   
/**
 * Starts mouse capture.
 */
protected void startMouseCapture() throws IOException {
    mouseCaptureTimer = new ScheduledThreadPoolExecutor(1);
    int delay = max(1, (int) (1000 / mouseFormat.get(FrameRateKey).doubleValue()));
    mouseGrabber = new MouseGrabber(this, recordingStartTime, mouseCaptureTimer);
    mouseFuture = mouseCaptureTimer.scheduleAtFixedRate(mouseGrabber, delay, delay, TimeUnit.MILLISECONDS);
    final MouseGrabber mouseGrabberF = mouseGrabber;
    awtEventListener = new AWTEventListener() {
        @Override
        public void eventDispatched(AWTEvent event) {
            if (event.getID() == MouseEvent.MOUSE_PRESSED) {
                mouseGrabberF.setMousePressed(true);
            } else if (event.getID() == MouseEvent.MOUSE_RELEASED) {
                mouseGrabberF.setMousePressed(false);
            }
        }
    };
    Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener, AWTEvent.MOUSE_EVENT_MASK);
    mouseGrabber.setFuture(mouseFuture);
}
项目: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;
}
项目:TwitchChatClient    文件:ActivityTracker.java   
/**
 * Start tracking activity (globally currently only mouse activity, inside
 * of the program keypresses and mouse actions).
 */
public static void startTracking() {
    if (timer == null) {
        checkMouseLocation();
        timer = new Timer(DELAY, new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                checkMouseLocation();
            }
        });
        timer.start();
        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            @Override
            public void eventDispatched(AWTEvent event) {
                triggerActivity();
            }
        }, AWTEvent.KEY_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK);
        LOGGER.info("Started tracking user activity..");
    }
}
项目: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;
}
项目:tools-idea    文件:MacUtil.java   
public static void adjustFocusTraversal(@NotNull Disposable disposable) {
  if (!SystemInfo.isMacOSSnowLeopard) return;
  final AWTEventListener listener = new AWTEventListener() {
    @Override
    public void eventDispatched(AWTEvent event) {
      if (event instanceof KeyEvent
          && ((KeyEvent)event).getKeyCode() == KeyEvent.VK_TAB
          && (!(event.getSource() instanceof JTextComponent))
          && (!(event.getSource() instanceof JList))
          && !isFullKeyboardAccessEnabled())
        ((KeyEvent)event).consume();
    }
  };
  Disposer.register(disposable, new Disposable() {
    @Override
    public void dispose() {
      Toolkit.getDefaultToolkit().removeAWTEventListener(listener);
    }
  });
  Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
}
项目: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;
}
项目:montemedia    文件:ScreenRecorder.java   
/**
 * Starts mouse capture.
 */
protected void startMouseCapture() throws IOException {
    mouseCaptureTimer = new ScheduledThreadPoolExecutor(1);
    int delay = max(1, (int) (1000 / mouseFormat.get(FrameRateKey).doubleValue()));
    mouseGrabber = new MouseGrabber(this, recordingStartTime, mouseCaptureTimer);
    mouseFuture = mouseCaptureTimer.scheduleAtFixedRate(mouseGrabber, delay, delay, TimeUnit.MILLISECONDS);
    final MouseGrabber mouseGrabberF = mouseGrabber;
    awtEventListener = new AWTEventListener() {
        @Override
        public void eventDispatched(AWTEvent event) {
            if (event.getID() == MouseEvent.MOUSE_PRESSED) {
                mouseGrabberF.setMousePressed(true);
            } else if (event.getID() == MouseEvent.MOUSE_RELEASED) {
                mouseGrabberF.setMousePressed(false);
            }
        }
    };
    Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener, AWTEvent.MOUSE_EVENT_MASK);
    mouseGrabber.setFuture(mouseFuture);
}