/** * 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). */ protected InputMap getRTextAreaInputMap() { InputMap map = new InputMapUIResource(); InputMap shared = (InputMap)UIManager.get(SHARED_INPUT_MAP_NAME); if (shared==null) { shared = new RTADefaultInputMap(); 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; }
/** * 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; }
@Override public void setParent(InputMap map) { version++; inputMap.setParent(map); }
InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_FOCUSED) { // PENDING JW: side-effect when reverting to ui manager? revisit! InputMap keyMap = (InputMap) UIManager.get("List.focusInputMap"); // InputMap keyMap = (InputMap)DefaultLookup.get( // list, this, "List.focusInputMap"); InputMap rtlKeyMap; if (isLeftToRight || ((rtlKeyMap = (InputMap) UIManager.get("List.focusInputMap.RightToLeft")) == null)) { // ((rtlKeyMap = (InputMap)DefaultLookup.get(list, this, // "List.focusInputMap.RightToLeft")) == null)) { return keyMap; } else { rtlKeyMap.setParent(keyMap); return rtlKeyMap; } } return null; }
private static void installMap(InputMap componentMap, boolean strict) { InputMap map = new AutoComplete.InputMap(); if (strict) { map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_BACK_SPACE, 0), DefaultEditorKit.selectionBackwardAction); // ignore VK_DELETE and CTRL+VK_X and beep instead when strict matching map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DELETE, 0), errorFeedbackAction); map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_DOWN_MASK), errorFeedbackAction); } else { // VK_BACKSPACE will move the selection to the left if the selected item is in the list // it will delete the previous character otherwise map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_BACK_SPACE, 0), "nonstrict-backspace"); // leave VK_DELETE and CTRL+VK_X as is } map.setParent(componentMap.getParent()); componentMap.setParent(map); }
private static void installMap(InputMap componentMap, boolean strict) { InputMap map = new AutoComplete.InputMap(); if (strict) { map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_BACK_SPACE, 0), DefaultEditorKit.selectionBackwardAction); // ignore VK_DELETE and CTRL+VK_X and beep instead when strict matching map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DELETE, 0), errorFeedbackAction); map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_DOWN_MASK), errorFeedbackAction); } else { // VK_BACKSPACE will move the selection to the left if the selected item is in the list // it will delete the previous character otherwise map.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_BACK_SPACE, 0), "nonstrict-backspace"); // leave VK_DELETE and CTRL+VK_X as is } map.setParent(componentMap.getParent()); componentMap.setParent(map); }
private static InputMap createDefaultInputMap(InputMap parent) { InputMap map = new InputMap(); map.setParent(parent); bindKeyStrokesFromMainMenuShortcuts(map); // Add KeyStrokes: Enter, Ctrl+Enter (Cmd+Enter for MacOS) map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), KEY_GO_TO_NEXT_SEGMENT); map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), KEY_GO_TO_PREVIOUS_SEGMENT); return map; }
private static InputMap createDefaultInputMapUseTab(InputMap parent) { InputMap map = new InputMap(); map.setParent(parent); bindKeyStrokesFromMainMenuShortcuts(map); // Add KeyStrokes: Tab, Shift+Tab, Ctrl+Tab, Ctrl+Shift+Tab // (Cmd+Tab is used by the system on OS X) map.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), KEY_GO_TO_NEXT_SEGMENT); map.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK), KEY_GO_TO_PREVIOUS_SEGMENT); map.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK), KEY_TRANSFER_FOCUS); map.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK), KEY_TRANSFER_FOCUS_BACKWARD); // Enter to jump to selected segment in editor map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), KEY_JUMP_TO_ENTRY_IN_EDITOR); return map; }
/** * Get the InputMap to use for the UI. */ InputMap getInputMap() { InputMap map = new InputMapUIResource(); InputMap shared = (InputMap)UIManager.get(getPropertyPrefix() + ".focusInputMap"); if (shared != null) { map.setParent(shared); } return map; }
InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) { InputMap keyMap = (InputMap)UIManager.get("ScrollPane.ancestorInputMap"); InputMap rtlKeyMap; if (scrollpane.getComponentOrientation().isLeftToRight() || ((rtlKeyMap = (InputMap)UIManager.get("ScrollPane.ancestorInputMap.RightToLeft")) == null)) { return keyMap; } else { rtlKeyMap.setParent(keyMap); return rtlKeyMap; } } return null; }
InputMap getMyInputMap(int condition) { if(condition==JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) { InputMap keyMap=(InputMap)UIManager.get("Table.ancestorInputMap"); InputMap rtlKeyMap; if(table.getComponentOrientation().isLeftToRight() || ((rtlKeyMap=(InputMap)UIManager.get("Table.ancestorInputMap.RightToLeft"))==null)) { return keyMap; } else { rtlKeyMap.setParent(keyMap); return rtlKeyMap; } } return null; }
/** * 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). */ 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; }
/** * Installs the state needed for mnemonics. */ private void initMnemonics() { _mnemonicToIndexMap = new Hashtable(); _mnemonicInputMap = new InputMapUIResource(); _mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(_tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)); SwingUtilities.replaceUIInputMap(_tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, _mnemonicInputMap); }
/** * Disables all the JSPlitPane accessibility shortcuts that are registered by default: * <ul> * <li>Navigate in - Tab * <li>Navigate out - Ctrl+Tab, Ctrl+Shift+Tab * <li>Navigate between - Tab, F6 * <li>Give focus spliter bar - F8 * <li>Change size - Arrow keys, home, and end (moves the pane splitter appropriately) * </ul> */ public void disableAccessibilityShortcuts() { InputMap inputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.clear(); inputMap.setParent(null); }
/** * Installs the state needed for mnemonics. */ private void initMnemonics() { mnemonicToIndexMap = new HashMap(); // mnemonicInputMap = new InputMapUIResource(); // mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)); // SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, mnemonicInputMap); mnemonicInputMap = new ComponentInputMapUIResource(tabPane); mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane, JComponent.WHEN_IN_FOCUSED_WINDOW)); SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_IN_FOCUSED_WINDOW, mnemonicInputMap); }
protected InputMap getRTextAreaInputMap() { // Except from modifiyKeystrokes() this is copied from RSyntaxTextAreaUI. // Not too nice InputMap map = new InputMapUIResource(); InputMap shared = (InputMap)UIManager.get("RSyntaxTextAreaUI.inputMap"); if (shared==null) { shared = new RSyntaxTextAreaDefaultInputMap(); modifiyKeystrokes(shared); UIManager.put("RSyntaxTextAreaUI.inputMap", 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; }
/** * Installs the state needed for mnemonics. */ private void initMnemonics() { mnemonicToIndexMap= new Hashtable(); mnemonicInputMap= new InputMapUIResource(); mnemonicInputMap.setParent( SwingUtilities.getUIInputMap( tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)); SwingUtilities.replaceUIInputMap( tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, mnemonicInputMap); }
InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) { InputMap keyMap = (InputMap) DefaultLookup.get(scrollpane, this, "ScrollPane.ancestorInputMap"); //$NON-NLS-1$ InputMap rtlKeyMap; if (scrollpane.getComponentOrientation().isLeftToRight() || ((rtlKeyMap = (InputMap) DefaultLookup.get(scrollpane, this, "ScrollPane.ancestorInputMap.RightToLeft")) == null)) { //$NON-NLS-1$ return keyMap; } else { rtlKeyMap.setParent(keyMap); return rtlKeyMap; } } return null; }
InputMap getInputMap(int condition, JSlider slider) { if (condition == JComponent.WHEN_FOCUSED) { InputMap keyMap = (InputMap) DefaultLookup.get(slider, this, "Slider.focusInputMap"); //$NON-NLS-1$ InputMap rtlKeyMap; if (slider.getComponentOrientation().isLeftToRight() || ((rtlKeyMap = (InputMap) DefaultLookup.get(slider, this, "Slider.focusInputMap.RightToLeft")) == null)) { //$NON-NLS-1$ return keyMap; } else { rtlKeyMap.setParent(keyMap); return rtlKeyMap; } } return null; }
InputMap getInputMap(int condition, JSlider slider) { if (condition == JComponent.WHEN_FOCUSED) { InputMap keyMap = (InputMap) DefaultLookup.get(slider, this, "Slider.focusInputMap"); //$NON-NLS-1$ InputMap rtlKeyMap; if (slider.getComponentOrientation().isLeftToRight() || ((rtlKeyMap = (InputMap) DefaultLookup.get(slider, this, "Slider.focusInputMap.RightToLeft")) == null)) { //$NON-NLS-1$ return keyMap; } else { rtlKeyMap.setParent(keyMap); return rtlKeyMap; } } return null; }