Java Code Examples for java.awt.event.MouseEvent#META_DOWN_MASK

The following examples show how to use java.awt.event.MouseEvent#META_DOWN_MASK . 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: WatchAnnotationProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean canDrag(MouseEvent e) {
    return (e.getModifiersEx() & (MouseEvent.ALT_DOWN_MASK |
                                  MouseEvent.ALT_GRAPH_DOWN_MASK |
                                  MouseEvent.CTRL_DOWN_MASK |
                                  MouseEvent.META_DOWN_MASK |
                                  MouseEvent.SHIFT_DOWN_MASK)) == 0;
}
 
Example 2
Source File: KeymapImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @return string representation of passed mouse shortcut. This method should
 *         be used only for serializing of the <code>MouseShortcut</code>
 */
private static String getMouseShortcutString(MouseShortcut shortcut) {
  StringBuilder buffer = new StringBuilder();

  // modifiers

  int modifiers = shortcut.getModifiers();
  if ((MouseEvent.SHIFT_DOWN_MASK & modifiers) > 0) {
    buffer.append(SHIFT);
    buffer.append(' ');
  }
  if ((MouseEvent.CTRL_DOWN_MASK & modifiers) > 0) {
    buffer.append(CONTROL);
    buffer.append(' ');
  }
  if ((MouseEvent.META_DOWN_MASK & modifiers) > 0) {
    buffer.append(META);
    buffer.append(' ');
  }
  if ((MouseEvent.ALT_DOWN_MASK & modifiers) > 0) {
    buffer.append(ALT);
    buffer.append(' ');
  }
  if ((MouseEvent.ALT_GRAPH_DOWN_MASK & modifiers) > 0) {
    buffer.append(ALT_GRAPH);
    buffer.append(' ');
  }

  // button

  buffer.append("button").append(shortcut.getButton()).append(' ');

  if (shortcut.getClickCount() > 1) {
    buffer.append(DOUBLE_CLICK);
  }
  return buffer.toString().trim(); // trim trailing space (if any)
}
 
Example 3
Source File: DesktopApi.java    From workcraft with MIT License 4 votes vote down vote up
public static int getMenuKeyMouseMask() {
    if (getOs().isMac()) {
        return MouseEvent.META_DOWN_MASK;
    }
    return MouseEvent.CTRL_DOWN_MASK;
}