本文整理了Java中java.awt.event.KeyEvent.getKeyText()
方法的一些代码示例,展示了KeyEvent.getKeyText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.getKeyText()
方法的具体详情如下:
包路径:java.awt.event.KeyEvent
类名称:KeyEvent
方法名:getKeyText
[英]Returns a String describing the keyCode, such as "HOME", "F1" or "A". These strings can be localized by changing the awt.properties file.
[中]返回描述键码的字符串,如“HOME”、“F1”或“a”。这些字符串可以通过更改awt进行本地化。属性文件。
代码示例来源:origin: runelite/runelite
key = KeyEvent.getKeyText(keyCode);
代码示例来源:origin: magefree/mage
private void fixText() {
if (keyCode == 0) {
text = "<None>";
} else {
text = KeyEvent.getKeyText(keyCode);
}
repaint();
}
代码示例来源:origin: RaiMan/SikuliX2
private void myKeyReleased(KeyEvent e) {
int code = e.getKeyCode();
if (e.CHAR_UNDEFINED != e.getKeyChar()) {
} else {
String cName = keyReleasedHandler(code, 1);
log.trace("keyReleased: %s (%d) %s %s %s", e.getKeyText(code), code, cName,
activeSides[activeSide], activeSides[activeSideSaved]);
}
}
代码示例来源:origin: RaiMan/SikuliX2
public void typeInt(Integer character, IDevice.Action action) {
log.trace("Robot: typeInt(%s): %s ( %d )", action,
KeyEvent.getKeyText(character), character);
doType(action, character);
}
代码示例来源:origin: magefree/mage
public static String getCachedKeyText(String key) {
int code = getCachedValue(key, getDefaultControlKey(key));
return KeyEvent.getKeyText(code);
}
代码示例来源:origin: magefree/mage
.append("<br/>Turn mousewheel down (ALT-s) - enlarge original/alternate image of card the mousepointer hovers over")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_CONFIRM, 113)))
.append("</b> - Confirm \"Ok\", \"Yes\" or \"Done\" button")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_NEXT_TURN, 115)))
.append("</b> - Skip current turn but stop on declare attackers/blockers and something on the stack")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_END_STEP, 116)))
.append("</b> - Skip to next end step but stop on declare attackers/blockers and something on the stack")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_SKIP_STEP, 117)))
.append("</b> - Skip current turn but stop on declare attackers/blockers")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_MAIN_STEP, 118)))
.append("</b> - Skip to next main phase but stop on declare attackers/blockers and something on the stack")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_YOUR_TURN, 120)))
.append("</b> - Skip everything until your next turn")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_PRIOR_END, 122)))
.append("</b> - Skip everything until the end step just prior to your turn")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_CANCEL_SKIP, 114)))
.append("</b> - Undo F4/F5/F7/F9/F11")
.append("<br/><b>")
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_TOGGLE_MACRO, 119)))
.append("</b> - Toggle recording a sequence of actions to repeat. Will not pause if interrupted and can fail if a selected card changes such as when scrying top card to bottom.")
.append("<br/><b>").append(System.getProperty("os.name").contains("Mac OS X") ? "Cmd" : "Ctrl").append(" + click</b> - Hold priority while casting a spell or activating an ability").toString(),
代码示例来源:origin: RaiMan/SikuliX2
keyText = KeyEvent.getKeyText(key);
if (keyText.startsWith("Unknown") && ("...".equals(k2) || key > 255)) {
continue;
代码示例来源:origin: org.netbeans.api/org-openide-awt
/** Same method as above, but works just with plain actions.
*/
private static String findKey(Action action) {
if (action == null) {
return null;
}
KeyStroke accelerator = (KeyStroke) action.getValue(Action.ACCELERATOR_KEY);
if (accelerator == null) {
return null;
}
int modifiers = accelerator.getModifiers();
String acceleratorText = ""; // NOI18N
if (modifiers > 0) {
acceleratorText = KeyEvent.getKeyModifiersText(modifiers);
acceleratorText += "+"; // NOI18N
} else if (accelerator.getKeyCode() == KeyEvent.VK_UNDEFINED) {
return ""; // NOI18N
}
acceleratorText += KeyEvent.getKeyText(accelerator.getKeyCode());
return acceleratorText;
}
代码示例来源:origin: RaiMan/SikuliX2
public void typeChar(char character, IDevice.Action action) {
log.trace("Robot: typeChar(%s): %s ( %d )", action,
KeyEvent.getKeyText(Keys.toJavaKeyCode(character)[0]),
Keys.toJavaKeyCode(character)[0]);
doType(action, Keys.toJavaKeyCode(character));
}
代码示例来源:origin: stackoverflow.com
String s = KeyEvent.getKeyText(ke.getKeyCode());
JButton b = getButton(s);
if (b != null) {
代码示例来源:origin: com.synaptix/SynaptixSwing
@Override
public void keyReleased(KeyEvent e) {
System.out.println(e.getKeyCode() + " " + e.getKeyChar() + " "
+ KeyEvent.getKeyText(e.getKeyCode()));
}
}
代码示例来源:origin: BaseXdb/basex
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(InputEvent.getModifiersExText(modifiers));
if(sb.length() != 0) sb.append('+');
return sb.append(getKeyText(key)).toString();
}
代码示例来源:origin: org.basex/basex
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(InputEvent.getModifiersExText(modifiers));
if(sb.length() != 0) sb.append('+');
return sb.append(getKeyText(key)).toString();
}
代码示例来源:origin: net.java.abeille/abeille
private static String prefixNumpad(String key, int testKeyCode) {
if (key.equals(KeyEvent.getKeyText(testKeyCode))) {
key = LocaleSupport.getString("key-prefix-numpad") + key;
}
return key;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
private static String prefixNumpad(String key, int testKeyCode) {
if (key.equals(KeyEvent.getKeyText(testKeyCode))) {
key = LocaleSupport.getString("key-prefix-numpad") + key;
}
return key;
}
代码示例来源:origin: freeplane/freeplane
/** pretty print a keystroke. */
public static String formatKeyStroke(final KeyStroke keyStroke) {
final String keyModifiersText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers());
final String keyText = KeyEvent.getKeyText(keyStroke.getKeyCode());
return keyModifiersText.length() == 0 ? keyText : keyModifiersText + "+" + keyText;
}
代码示例来源:origin: org.nakedobjects/nos-viewer-dnd
public void released(final int keyCode, final int modifiers) {
if (ignoreKey(keyCode)) {
return;
}
LOG.debug("key " + KeyEvent.getKeyText(keyCode) + " released\n");
View keyboardFocus = getFocus();
if (keyboardFocus != null) {
keyboardFocus.keyReleased(keyCode, modifiers);
}
}
代码示例来源:origin: RaiMan/SikuliX2
script.log.trace("META_MASK + %s", KeyEvent.getKeyText(keyCode));
return false;
Script.log.trace("keycode: %d %s", keyCode, KeyEvent.getKeyText(keyCode));
代码示例来源:origin: RaiMan/SikuliX2
public void typeKey(int key) {
log.trace("Robot: doType: %s ( %d )", KeyEvent.getKeyText(key), key);
if (SX.isMac()) {
if (key == Keys.toJavaKeyCodeFromText("#N.")) {
doType(Action.DOWN, Keys.toJavaKeyCodeFromText("#C."));
doType(Action.DOWNUP, key);
doType(Action.UP, Keys.toJavaKeyCodeFromText("#C."));
return;
} else if (key == Keys.toJavaKeyCodeFromText("#T.")) {
doType(Action.DOWN, Keys.toJavaKeyCodeFromText("#C."));
doType(Action.DOWN, Keys.toJavaKeyCodeFromText("#A."));
doType(Action.DOWNUP, key);
doType(Action.UP, Keys.toJavaKeyCodeFromText("#A."));
doType(Action.UP, Keys.toJavaKeyCodeFromText("#C."));
return;
} else if (key == Keys.toJavaKeyCodeFromText("#X.")) {
key = Keys.toJavaKeyCodeFromText("#T.");
doType(Action.DOWN, Keys.toJavaKeyCodeFromText("#A."));
doType(Action.DOWNUP, key);
doType(Action.UP, Keys.toJavaKeyCodeFromText("#A."));
return;
}
}
doType(Action.DOWNUP, key);
}
代码示例来源:origin: abc9070410/JComicDownloader
private JButton getButton(String string, String enString, String toolTip, String picName, int keyID) {
string = Common.getStringUsingDefaultLanguage(string, enString); // 使用預設語言
JButton button = new JButton(string, new CommonGUI().getImageIcon(picName));
CommonGUI.setToolTip(button, toolTip + " 快捷鍵: Alt + " + KeyEvent.getKeyText(keyID));
button.setFont(SetUp.getDefaultFont(5));
if (SetUp.getUsingBackgroundPicOfMainFrame()) { // 若設定為透明,就用白色字體。
button.setForeground(SetUp.getMainFrameOtherDefaultColor());
button.setOpaque(false);
}
button.setMnemonic(keyID); // 設快捷建為Alt + keyID
return button;
}
内容来源于网络,如有侵权,请联系作者删除!