本文整理匯總了Java中javax.swing.KeyStroke.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyStroke.toString方法的具體用法?Java KeyStroke.toString怎麽用?Java KeyStroke.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.KeyStroke
的用法示例。
在下文中一共展示了KeyStroke.toString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: putActionDelegate
import javax.swing.KeyStroke; //導入方法依賴的package包/類
private void putActionDelegate(InputMap map, KeyStroke ks) {
String binding = COPY_ACTION_DELEGATE+ks.toString();
Action action = getCopyActionDelegate(map, ks);
if (action != null) {
getActionMap().put(binding, action);
map.put(ks, binding);
}
}
示例2: getExpandKeyStrokeText
import javax.swing.KeyStroke; //導入方法依賴的package包/類
private static String getExpandKeyStrokeText(KeyStroke keyStroke) {
String expandKeyStrokeText;
if (keyStroke.equals(KeyStroke.getKeyStroke(' '))) { //NOI18N
expandKeyStrokeText = "SPACE"; // NOI18N
} else if (keyStroke.equals(KeyStroke.getKeyStroke(new Character(' '), InputEvent.SHIFT_MASK))) { //NOI18N
expandKeyStrokeText = "Shift-SPACE"; // NOI18N
} else if (keyStroke.equals(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0))) {
expandKeyStrokeText = "TAB"; // NOI18N
} else if (keyStroke.equals(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0))) {
expandKeyStrokeText = "ENTER"; // NOI18N
} else {
expandKeyStrokeText = keyStroke.toString();
}
return expandKeyStrokeText;
}
示例3: getKeyStrokeText
import javax.swing.KeyStroke; //導入方法依賴的package包/類
/**
* Creates a {@code String} that keeps the attributes given
* {@code KeyStroke}. This {@code String} can be used to
* store the key stroke in an XML-file.
*
* @param keyStroke The {@code KeyStroke}.
* @return A {@code String} that produces a key stroke equal to the
* given {@code KeyStroke} if passed as a parameter to
* {@code getAWTKeyStroke(String)}.
*/
public static String getKeyStrokeText(KeyStroke keyStroke) {
return (keyStroke == null) ? "" : keyStroke.toString();
}