do { iMap.remove(keyStroke); iMap = iMap.getParent(); } while (iMap != null); getInputMap().put(keyStroke, REPLACE);
/** * 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); } }
@Override public InputMap getParent() { return inputMap.getParent(); }
KeyStroke copy = KeyStroke.getKeyStroke("control C"); InputMap im = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); im.getParent().remove(copy);
KeyStroke space = KeyStroke.getKeyStroke("pressed SPACE"); InputMap im = comboBox.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); im.getParent().remove(space);
private static void removeKeyBinding(InputMap im, KeyStroke ks) { // Remove the key binding from the second "tier" input map // User bindings are stored in the first tier, where as UI // bindings (installed by the LAF) are stored in the second tier; if (im.getParent() != null) { im.getParent().remove(ks); } }
private static void removeKeyBinding(InputMap im, KeyStroke ks) { // Remove the key binding from the second "tier" input map // User bindings are stored in the first tier, where as UI // bindings (installed by the LAF) are stored in the second tier; if (im.getParent() != null) { im.getParent().remove(ks); } }
private static void removeKeyBinding(InputMap im, KeyStroke ks) { // Remove the key binding from the second "tier" input map // User bindings are stored in the first tier, where as UI // bindings (installed by the LAF) are stored in the second tier; if (im.getParent() != null) { im.getParent().remove(ks); } }
private static void removeKeyBinding(InputMap im, KeyStroke ks) { // Remove the key binding from the second "tier" input map // User bindings are stored in the first tier, where as UI // bindings (installed by the LAF) are stored in the second tier; if (im.getParent() != null) { im.getParent().remove(ks); } }
KeyStroke keyToRemove = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); InputMap imap = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); while (imap != null) { imap.remove(keyToRemove); imap = imap.getParent(); }
/** * 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(); } KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE"); inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction); }
/** * 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(); } KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE"); inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction); }
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); }
/** * 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); } }
@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; }
private static void clearInputMap(InputMap inputMap) { inputMap.clear(); while ((inputMap = inputMap.getParent()) != null) { inputMap.clear(); } }
private static void removeMenuModifierBindings( InputMap imap, int primary, Set keySet ) { if( imap == null ) return; final KeyStroke[] keys = imap.keys(); if( keys != null ) { for( int i = 0; i < keys.length; i++ ) { final KeyStroke k = keys[ i ]; if( (k.getModifiers() != primary) && keySet.contains( k )) { imap.remove( k ); } } } removeMenuModifierBindings( imap.getParent(), primary, keySet ); } }
private void initInputMap(boolean useTabForAdvance) { setFocusTraversalKeysEnabled(!useTabForAdvance); InputMap parent = getInputMap().getParent(); InputMap newMap = useTabForAdvance ? createDefaultInputMapUseTab(parent) : createDefaultInputMap(parent); setInputMap(WHEN_FOCUSED, newMap); }
private void setupUI() { UIManager.put("Tree.repaintWholeRow", Boolean.TRUE); // Remove all key strokes InputMap inputMap = getInputMap().getParent(); for (KeyStroke k : getRegisteredKeyStrokes()) { inputMap.remove(k); } setUI(new TranslationTreeUI()); setCellRenderer(new TranslationTreeCellRenderer()); addTreeWillExpandListener(new TranslationTreeExpandListener()); addMouseListener(new TranslationTreeMouseListener()); setEditable(false); setOpaque(false); }