當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyStroke.toString方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:OutlineView.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:CodeTemplateManagerOperation.java

示例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();
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:14,代碼來源:FreeColAction.java


注:本文中的javax.swing.KeyStroke.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。