Java Code Examples for java.awt.event.InputEvent#getWhen()

The following examples show how to use java.awt.event.InputEvent#getWhen() . 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: GlobalCursorManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 2
Source File: GlobalCursorManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 3
Source File: GlobalCursorManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 4
Source File: GlobalCursorManager.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 5
Source File: GlobalCursorManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 6
Source File: HTMLView.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void invokeMiddleButtonAction(URL url, InputEvent e) {
    HeapViewerNode node = nodeForURL(url, context);
    if (node == null) return;

    HeapViewerNodeAction.Actions nodeActions = HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions);
    ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers()); // NO18N
    nodeActions.performMiddleButtonAction(ae);
}
 
Example 7
Source File: HTMLView.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void invokeDefaultAction(URL url, InputEvent e) {
    HeapViewerNode node = nodeForURL(url, context);
    if (node == null) return;

    HeapViewerNodeAction.Actions nodeActions = HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions);
    ActionEvent ae = e == null ? new ActionEvent(htmlComponent, ActionEvent.ACTION_PERFORMED, "link"): // NO18N
                                 new ActionEvent(e.getSource(), e.getID(), "link", e.getWhen(), e.getModifiers()); // NO18N
    nodeActions.performDefaultAction(ae);
}
 
Example 8
Source File: GlobalCursorManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 9
Source File: GlobalCursorManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 10
Source File: GlobalCursorManager.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 11
Source File: KeyPromoter.java    From IntelliJ-Key-Promoter-X with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void beforeActionPerformed(@NotNull AnAction action, @NotNull DataContext dataContext, AnActionEvent event) {
  final InputEvent input = event.getInputEvent();
  if (input instanceof MouseEvent) {
    // The following is a hack to work around an issue with IDEA, where certain events arrive
    // twice. See https://youtrack.jetbrains.com/issue/IDEA-219133
    if (input.getWhen() != 0 && lastEventTime == input.getWhen()) {
      return;
    }
    lastEventTime = input.getWhen();

    final String place = event.getPlace();
    KeyPromoterAction kpAction;
    if ("MainMenu".equals(place)) {
      if (keyPromoterSettings.isMenusEnabled()) {
        kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.MENU_ENTRY);
        showTip(kpAction);
      }
    } else if ("MainToolbar".equals(place)) {
      if (keyPromoterSettings.isToolbarButtonsEnabled()) {
        kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.MAIN_TOOLBAR);
        showTip(kpAction);
      }
    } else if (place.matches(".*Popup")) {
      if (keyPromoterSettings.isEditorPopupEnabled()) {
        kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.POPUP);
        showTip(kpAction);
      }
    } else if (keyPromoterSettings.isAllButtonsEnabled()) {
      kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.OTHER);
      showTip(kpAction);
    }
  }
}
 
Example 12
Source File: GlobalCursorManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 13
Source File: GlobalCursorManager.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 14
Source File: GlobalCursorManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 15
Source File: GlobalCursorManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 16
Source File: GlobalCursorManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}
 
Example 17
Source File: GlobalCursorManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called in response to Java MOUSE_MOVED events. The update
 * will be discarded if the InputEvent is outdated.
 *
 * @param   e the InputEvent which triggered the cursor update.
 */
public void updateCursorImmediately(InputEvent e) {
    boolean shouldUpdate;
    synchronized (lastUpdateLock) {
        shouldUpdate = (e.getWhen() >= lastUpdateMillis);
    }
    if (shouldUpdate) {
        _updateCursor(true);
    }
}