类javax.swing.plaf.InputMapUIResource源码实例Demo

下面列出了怎么用javax.swing.plaf.InputMapUIResource的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FlatLaf   文件: FlatInputMaps.java
@Override
public Object createValue( UIDefaults table ) {
	InputMap inputMap = new InputMapUIResource();
	for( Object[] bindings : bindingsArray )
		LookAndFeel.loadKeyBindings( inputMap, bindings );
	return inputMap;
}
 
源代码2 项目: iBioSim   文件: CloseTabPaneUI.java
/**
 * Installs the state needed for mnemonics.
 */
private void initMnemonics() {
	mnemonicToIndexMap = new Hashtable<Integer, Integer>();
	mnemonicInputMap = new InputMapUIResource();
	mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, mnemonicInputMap);
}
 
源代码3 项目: stendhal   文件: StyledLookAndFeel.java
/**
 * A hack to work around swing hard coding key bindings, and providing
 * no reasonable way to access the native ones. Add new components and
 * key bindings here when mac users report them.
 *
 * @param table A mess of all UI defaults crammed in one hash map
 */
private void restoreSystemKeymaps(UIDefaults table) {
	/*
	 * Input mappings that need to be tuned. the list is not exhaustive and
	 * will likely need more entries when new components start to be used.
	 */
	String[] keys = { "EditorPane.focusInputMap",
			"FormattedTextField.focusInputMap",
			"PasswordField.focusInputMap",
			"TextArea.focusInputMap",
			"TextField.focusInputMap",
			"TextPane.focusInputMap" };

	// Native modifier key. Ctrl for others, cmd on mac
	int modifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();

	for (String key : keys) {
		Object value = table.get(key);
		if (value instanceof InputMapUIResource) {
			InputMapUIResource map = (InputMapUIResource) value;

			// CUT
			remapKey(map, KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK, modifier);

			// COPY
			remapKey(map, KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK, modifier);

			// PASTE
			remapKey(map, KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK, modifier);

			// SELECT ALL
			remapKey(map, KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK, modifier);
		} else {
			Logger.getLogger(StyledLookAndFeel.class).error("Can not modify resource: " + key);
		}
	}
}
 
源代码4 项目: stendhal   文件: StyledLookAndFeel.java
/**
 * Remap a swing default key binding to a native one, if needed.
 *
 * @param map keymap to be modified
 * @param key
 * @param defaultModifier swing default modifier key for the action
 * @param nativeModifier native modifier key for the action
 */
private void remapKey(InputMapUIResource map, int key, int defaultModifier,
		int nativeModifier) {
	KeyStroke defaultKey = KeyStroke.getKeyStroke(key, defaultModifier);
	Object action = map.get(defaultKey);

	KeyStroke nativeKey = KeyStroke.getKeyStroke(key, nativeModifier);
	if (!nativeKey.equals(defaultKey)) {
		map.remove(defaultKey);
		map.put(nativeKey, action);
	}
}
 
源代码5 项目: cuba   文件: App.java
protected void initLookAndFeelDefaults() {
    InputMapUIResource inputMap =
            (InputMapUIResource) UIManager.getLookAndFeelDefaults().get("FormattedTextField.focusInputMap");
    inputMap.remove(KeyStroke.getKeyStroke("ESCAPE"));
}
 
源代码6 项目: tn5250j   文件: BasicTerminalUI.java
protected InputMap getInputMap()
{
  InputMap map = new InputMapUIResource();

  return map;
}
 
 类所在包
 类方法
 同包方法