当前位置: 首页>>代码示例>>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;未经允许,请勿转载。