java.awt.event.KeyEvent.isMetaDown()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(208)

本文整理了Java中java.awt.event.KeyEvent.isMetaDown()方法的一些代码示例,展示了KeyEvent.isMetaDown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.isMetaDown()方法的具体详情如下:
包路径:java.awt.event.KeyEvent
类名称:KeyEvent
方法名:isMetaDown

KeyEvent.isMetaDown介绍

暂无

代码示例

代码示例来源:origin: runelite/runelite

boolean isModifierDown = OSType.getOSType() == OSType.MacOS ? e.isMetaDown() : e.isControlDown();

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

/**
 * @see KeyEvent
 */
public boolean isMetaDown() {
  return event.isMetaDown();
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

/**
 * @see KeyEvent
 */
public boolean isMetaDown() {
  return event.isMetaDown();
}

代码示例来源:origin: featurecat/lizzie

private boolean controlIsPressed(KeyEvent e) {
 boolean mac = System.getProperty("os.name", "").toUpperCase().startsWith("MAC");
 return e.isControlDown() || (mac && e.isMetaDown());
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = META_DOWN_JS_DOC)
public boolean isMetaDown() {
  return delegate.isMetaDown();
}

代码示例来源:origin: CognizantQAHub/Cognizant-Intelligent-Test-Scripter

private static boolean isSave(KeyEvent ke) {
  return (ke.isMetaDown() || ke.isControlDown()) && ke.getKeyCode() == KeyEvent.VK_S;
}

代码示例来源:origin: igniterealtime/Spark

public void keyPressed(KeyEvent keyEvent) {
  if (keyEvent.isMetaDown()) {
    if (keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) {
      navigateRight();
    }
    else if (keyEvent.getKeyCode() == KeyEvent.VK_LEFT) {
      navigateLeft();
    }
  }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public boolean dispatchKeyEvent(KeyEvent e) {
  if (!e.isConsumed()) {
   if (e.isMetaDown()) {
    if (e.getKeyCode() == KeyEvent.VK_V
     || e.getKeyCode() == KeyEvent.VK_A
     || e.getKeyCode() == KeyEvent.VK_C
     || e.getKeyCode() == KeyEvent.VK_X) {
     e.setModifiers(KeyEvent.CTRL_DOWN_MASK);
    }
   }
  }
  return false;
 }
});

代码示例来源:origin: Waikato/weka-trunk

@Override
 public boolean dispatchKeyEvent(KeyEvent e) {
  if (!e.isConsumed()) {
   if (e.isMetaDown()) {
    if (e.getKeyCode() == KeyEvent.VK_V
     || e.getKeyCode() == KeyEvent.VK_A
     || e.getKeyCode() == KeyEvent.VK_C
     || e.getKeyCode() == KeyEvent.VK_X) {
     e.setModifiers(KeyEvent.CTRL_DOWN_MASK);
    }
   }
  }
  return false;
 }
});

代码示例来源:origin: org.basex/basex

/**
 * Returns true if the pressed key is a modifier key (including 'escape' and 'tab' + control key).
 * @param e key event
 * @return result of check
 */
public static boolean modifier(final KeyEvent e) {
 final int c = e.getKeyCode();
 return c == VK_ALT || c == VK_SHIFT || c == VK_META || c == VK_CONTROL ||
   c == VK_PAUSE || c == VK_CAPS_LOCK || c == VK_ESCAPE ||
   c == VK_TAB && (e.isAltDown() || e.isMetaDown() || e.isControlDown());
}

代码示例来源:origin: BaseXdb/basex

/**
 * Returns true if the pressed key is a modifier key (including 'escape' and 'tab' + control key).
 * @param e key event
 * @return result of check
 */
public static boolean modifier(final KeyEvent e) {
 final int c = e.getKeyCode();
 return c == VK_ALT || c == VK_SHIFT || c == VK_META || c == VK_CONTROL ||
   c == VK_PAUSE || c == VK_CAPS_LOCK || c == VK_ESCAPE ||
   c == VK_TAB && (e.isAltDown() || e.isMetaDown() || e.isControlDown());
}

代码示例来源:origin: org.basex/basex

/**
 * Returns true if the pressed key includes a control key.
 * @param e key event
 * @return result of check
 */
public static boolean control(final KeyEvent e) {
 // With Mac, special characters are available via ALT
 return e.isControlDown() || e.isMetaDown() || !MAC && e.isAltDown();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

private void setModifiers(KeyEvent ke) {
  if (ke.isShiftDown() || ke.isControlDown() || ke.isAltDown() || ke.isMetaDown()) {
    panel.shiftCheckbox.setSelected(ke.isShiftDown());
    panel.controlCheckbox.setSelected(ke.isControlDown());
    panel.altCheckbox.setSelected(ke.isAltDown());
    panel.metaCheckbox.setSelected(ke.isMetaDown());
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

boolean isTypeAheadKey(KeyEvent e)
  {
    return !e.isAltDown() && !e.isControlDown() && !e.isMetaDown();
  }
}

代码示例来源:origin: BaseXdb/basex

/**
 * Returns true if the pressed key includes a control key.
 * @param e key event
 * @return result of check
 */
public static boolean control(final KeyEvent e) {
 // With Mac, special characters are available via ALT
 return e.isControlDown() || e.isMetaDown() || !MAC && e.isAltDown();
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

public void keyPressed(KeyEvent event) {
  if (event.getKeyChar() == 'v' && event.isMetaDown()) {
   performPaste();
   // Consume the event to stop a double paste
   event.consume();
   // Fire a component change event so that handlers for things like button enabling get to run
   ViewEvents.fireComponentChangedEvent(getModel().get().getPanelName(), getModel());
  }
 }
});

代码示例来源:origin: JetBrains/jediterm

public static boolean isReallyTypedEvent(KeyEvent e) {
  char c = e.getKeyChar();
  if (c < 0x20 || c == 0x7F) return false;
  if (SystemInfo.isMac) {
    return !e.isMetaDown() && !e.isControlDown();
  }
  return !e.isAltDown() && !e.isControlDown();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

private String toString(KeyEvent ke) {
  if (!ke.isShiftDown() && !ke.isControlDown() && !ke.isAltDown() && !ke.isMetaDown()) {
    int modifiers = panel.altCheckbox.isSelected() ? KeyEvent.ALT_MASK : 0;
    modifiers = modifiers | (panel.controlCheckbox.isSelected() ? KeyEvent.CTRL_MASK : 0);
    modifiers = modifiers | (panel.metaCheckbox.isSelected() ? KeyEvent.META_MASK : 0);
    modifiers = modifiers | (panel.shiftCheckbox.isSelected() ? KeyEvent.SHIFT_MASK : 0);
    ke = new KeyEvent((Component)ke.getSource(), ke.getID(), ke.getWhen(), modifiers, ke.getKeyCode(), ke.getKeyChar());
  }
  keyStroke = KeyStroke.getKeyStrokeForEvent(ke);
  currentKeyCode = ke.getKeyCode();
  return KeyEvent.getKeyText(currentKeyCode);
}

代码示例来源:origin: AliView/AliView

public void keyTyped(KeyEvent e){
  logger.info("is typed");
  if(e.isControlDown() || e.isAltDown() || e.isAltGraphDown() || e.isMetaDown()){
    // Skip
  }else{
    char typed = e.getKeyChar();
    String allowedChars = "QWERTYUIOPASDFGHJKLZXCVBNM?qwertyuiopasdfghjklzxcvbnm";
    if(allowedChars.indexOf(typed) > -1){
      if(aliViewWindow.requestEditMode()){		
        replaceSelectedWithChar(typed);
      }
    }
  }
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

@Override
  public void keyReleased(KeyEvent e) {
    if (!e.isAltDown() && !e.isAltGraphDown() && !e.isControlDown()
        && !e.isMetaDown() && !e.isShiftDown()) {
      searchFieldKeyReleased(e);
    }
  }
});

相关文章