本文整理了Java中org.openide.util.Utilities.keyToString()
方法的一些代码示例,展示了Utilities.keyToString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.keyToString()
方法的具体详情如下:
包路径:org.openide.util.Utilities
类名称:Utilities
方法名:keyToString
[英]Converts a Swing key stroke descriptor to a familiar Emacs-like name.
[中]将摆动键笔划描述符转换为熟悉的类似于Emacs的名称。
代码示例来源:origin: org.netbeans.api/org-openide-util
/**
* Converts a Swing key stroke descriptor to a familiar Emacs-like name,
* but in a portable way, ie. <code>Meta-C</code> on Mac => <code>D-C</code>
* @param stroke key description
* @return name of the key (e.g. <code>CS-F1</code> for control-shift-function key one)
* @see #stringToKey
*/
public static String keyToString(KeyStroke stroke, boolean portable) {
if (portable) {
StringBuilder sb = new StringBuilder();
// add modifiers that must be pressed
if (addModifiersPortable(sb, stroke.getModifiers())) {
sb.append('-');
}
appendRest(sb, stroke);
return sb.toString();
}
return keyToString(stroke);
}
代码示例来源:origin: org.netbeans.api/org-openide-util-ui
/**
* Converts a Swing key stroke descriptor to a familiar Emacs-like name,
* but in a portable way, ie. <code>Meta-C</code> on Mac => <code>D-C</code>
* @param stroke key description
* @return name of the key (e.g. <code>CS-F1</code> for control-shift-function key one)
* @see #stringToKey
*/
public static String keyToString(KeyStroke stroke, boolean portable) {
if (portable) {
StringBuilder sb = new StringBuilder();
// add modifiers that must be pressed
if (addModifiersPortable(sb, stroke.getModifiers())) {
sb.append('-');
}
appendRest(sb, stroke);
return sb.toString();
}
return keyToString(stroke);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-wizards
public static String keyToLogicalString(KeyStroke keyStroke) {
String keyDesc = Utilities.keyToString(keyStroke);
int dash = keyDesc.indexOf('-');
return dash == -1 ? keyDesc :
keyDesc.substring(0, dash).replace('C', 'D').replace('A', 'O') + keyDesc.substring(dash);
}
代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util
/**
* Converts a Swing key stroke descriptor to a familiar Emacs-like name,
* but in a portable way, ie. <code>Meta-C</code> on Mac => <code>D-C</code>
* @param stroke key description
* @return name of the key (e.g. <code>CS-F1</code> for control-shift-function key one)
* @see #stringToKey
*/
public static String keyToString(KeyStroke stroke, boolean portable) {
if (portable) {
StringBuilder sb = new StringBuilder();
// add modifiers that must be pressed
if (addModifiersPortable(sb, stroke.getModifiers())) {
sb.append('-');
}
appendRest(sb, stroke);
return sb.toString();
}
return keyToString(stroke);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-wizards
public static String keyStrokeToString(KeyStroke keyStroke) {
int modifiers = keyStroke.getModifiers();
StringBuffer sb = new StringBuffer();
if ((modifiers & InputEvent.CTRL_DOWN_MASK) > 0) {
sb.append("Ctrl+"); // NOI18N
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) > 0) {
sb.append("Alt+"); // NOI18N
}
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) > 0) {
sb.append("Shift+"); // NOI18N
}
if ((modifiers & InputEvent.META_DOWN_MASK) > 0) {
sb.append("Meta+"); // NOI18N
}
if (keyStroke.getKeyCode() != KeyEvent.VK_SHIFT &&
keyStroke.getKeyCode() != KeyEvent.VK_CONTROL &&
keyStroke.getKeyCode() != KeyEvent.VK_META &&
keyStroke.getKeyCode() != KeyEvent.VK_ALT &&
keyStroke.getKeyCode() != KeyEvent.VK_ALT_GRAPH) {
sb.append(Utilities.keyToString(
KeyStroke.getKeyStroke(keyStroke.getKeyCode(), 0)));
}
return sb.toString();
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
ActionEvent ev = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks));
action.actionPerformed(ev);
} else {
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
ActionEvent ev = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks));
action.actionPerformed(ev);
} else {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-remotefs-versioning-api
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
boolean ret = super.processKeyBinding(ks, e, condition, pressed);
// XXX #250546 Reason of overriding: to process global shortcut.
if ((JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT == condition) && (ret == false) && !e.isConsumed()) {
Keymap km = Lookup.getDefault().lookup(Keymap.class);
Action action = (km != null) ? km.getAction(ks) : null;
if (action == null) {
return false;
}
if (action instanceof CallbackSystemAction) {
CallbackSystemAction csAction = (CallbackSystemAction) action;
if (tabbedPane != null) {
Action a = tabbedPane.getActionMap().get(csAction.getActionMapKey());
if (a != null) {
a.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks)));
return true;
}
}
}
return false;
} else {
return ret;
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-spi-quicksearch
keyStroke.getKeyCode () != KeyEvent.VK_ALT_GRAPH
sb.append (Utilities.keyToString (
KeyStroke.getKeyStroke (keyStroke.getKeyCode (), 0)
));
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore
String keyText = org.openide.util.Utilities.keyToString(toggleKey);
filtersPanel.setToolTipText(NbBundle.getMessage(SVGNavigatorContent.class, "TIP_TapPanel", keyText)); //NOI18N
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
String keyText = Utilities.keyToString(toggleKey);
filtersPanel.setToolTipText(NbBundle.getMessage(ClassMemberPanelUI.class, "TIP_TapPanel", keyText));
内容来源于网络,如有侵权,请联系作者删除!