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


Java InputMap.getParent方法代碼示例

本文整理匯總了Java中javax.swing.InputMap.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java InputMap.getParent方法的具體用法?Java InputMap.getParent怎麽用?Java InputMap.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.InputMap的用法示例。


在下文中一共展示了InputMap.getParent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toString

import javax.swing.InputMap; //導入方法依賴的package包/類
/** Converts an action map to a string representation. */
static public String toString(InputMap im) {
    StringBuilder result = new StringBuilder();
    LinkedHashMap<Object,Object> map = new LinkedHashMap<>();
    for (KeyStroke key : im.allKeys()) {
        map.put(key, im.get(key));
    }
    result.append(map);
    result.append('\n');
    InputMap parent = im.getParent();
    if (parent != null) {
        result.append("Parent: ");
        result.append(toString(parent));
    }
    return result.toString();
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:17,代碼來源:Groove.java

示例2: createCommandField

import javax.swing.InputMap; //導入方法依賴的package包/類
@Override
protected JTextComponent createCommandField() {
    JTextArea res = new DynamicWidthTA();
    res.setRows(1);
    res.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 1));
    // disable default Swing's Ctrl+Shift+O binding to enable our global action
    InputMap curIm = res.getInputMap(JComponent.WHEN_FOCUSED);
    while (curIm != null) {
        curIm.remove(KeyStroke.getKeyStroke(
                KeyEvent.VK_O, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
        curIm = curIm.getParent();
    }
    return res;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:QuickSearchComboBar.java

示例3: fixCtrlH

import javax.swing.InputMap; //導入方法依賴的package包/類
/**
 * Removes the "Ctrl+H <=> Backspace" behavior that Java shows, for some
 * odd reason...
 */
private void fixCtrlH() {
	InputMap inputMap = getInputMap();
	KeyStroke char010 = KeyStroke.getKeyStroke("typed \010");
	InputMap parent = inputMap;
	while (parent != null) {
		parent.remove(char010);
		parent = parent.getParent();
	}
	if (inputMap != null) { // Just for Sonar
		KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE");
		inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction);
	}
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:18,代碼來源:RTextArea.java

示例4: shouldRegisterBindings

import javax.swing.InputMap; //導入方法依賴的package包/類
/**
    * Returns whether or not bindings should be registered on the given
    * <code>JComponent</code>. This is implemented to return true if the
    * tool tip manager has a binding in any one of the
    * <code>InputMaps</code> registered under the condition
    * <code>WHEN_FOCUSED</code>.
    * <p>
    * This does not use <code>isFocusTraversable</code> as
    * some components may override <code>isFocusTraversable</code> and
    * base the return value on something other than bindings. For example,
    * <code>JButton</code> bases its return value on its enabled state.
    *
    * @param component  the <code>JComponent</code> in question
    */
   private boolean shouldRegisterBindings(JComponent component) {
InputMap inputMap = component.getInputMap(JComponent.WHEN_FOCUSED);
while (inputMap != null && inputMap.size() == 0) {
    inputMap = inputMap.getParent();
}
return (inputMap != null);
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:ToolTipManagerEx.java


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