当前位置: 首页>>代码示例>>Java>>正文


Java InputMap.setParent方法代码示例

本文整理汇总了Java中javax.swing.InputMap.setParent方法的典型用法代码示例。如果您正苦于以下问题:Java InputMap.setParent方法的具体用法?Java InputMap.setParent怎么用?Java InputMap.setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.InputMap的用法示例。


在下文中一共展示了InputMap.setParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupKeymap

import javax.swing.InputMap; //导入方法依赖的package包/类
private void setupKeymap(Set<Action> actions) {
JComponent comp = term.getScreen();

ActionMap actionMap = comp.getActionMap();
ActionMap newActionMap = new ActionMap();
newActionMap.setParent(actionMap);

printActionMap(actionMap);

InputMap inputMap = comp.getInputMap();
InputMap newInputMap = new InputMap();
newInputMap.setParent(inputMap);

Set<KeyStroke> passKeystrokes = new HashSet<KeyStroke>();

for (Action a : actions) {
    String name = (String) a.getValue(Action.NAME);
           KeyStroke accelerator = (KeyStroke) a.getValue(Action.ACCELERATOR_KEY);
    System.out.printf("Registering %s for %s\n", accelerator, name);
    if (accelerator == null)
	continue;
    newInputMap.put(accelerator, name);
    newActionMap.put(name, a);
    passKeystrokes.add(accelerator);
}

comp.setActionMap(newActionMap);
comp.setInputMap(JComponent.WHEN_FOCUSED, newInputMap);

       term.setKeyStrokeSet((HashSet) passKeystrokes);
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:Terminal.java

示例2: getRTextAreaInputMap

import javax.swing.InputMap; //导入方法依赖的package包/类
/**
 * Get the InputMap to use for the UI.<p>
 *
 * This method is not named <code>getInputMap()</code> because there is
 * a package-private method in <code>BasicTextAreaUI</code> with that name.
 * Thus, creating a new method with that name causes certain compilers to
 * issue warnings that you are not actually overriding the original method
 * (since it is package-private).
 */
@Override
protected InputMap getRTextAreaInputMap() {
	InputMap map = new InputMapUIResource();
	InputMap shared = (InputMap)UIManager.get(SHARED_INPUT_MAP_NAME);
	if (shared==null) {
		shared = new RSyntaxTextAreaDefaultInputMap();
		UIManager.put(SHARED_INPUT_MAP_NAME, shared);
	}
	//KeyStroke[] keys = shared.allKeys();
	//for (int i=0; i<keys.length; i++)
	//	System.err.println(keys[i] + " -> " + shared.get(keys[i]));
	map.setParent(shared);
	return map;
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:24,代码来源:RSyntaxTextAreaUI.java


注:本文中的javax.swing.InputMap.setParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。