Example usage for javax.swing.text JTextComponent getInputMap

List of usage examples for javax.swing.text JTextComponent getInputMap

Introduction

In this page you can find the example usage for javax.swing.text JTextComponent getInputMap.

Prototype

public final InputMap getInputMap() 

Source Link

Document

Returns the InputMap that is used when the component has focus.

Usage

From source file:org.executequery.gui.editor.autocomplete.QueryEditorAutoCompletePopupProvider.java

private void resetEditorActions() {

    JTextComponent textComponent = queryEditorTextComponent();

    ActionMap actionMap = textComponent.getActionMap();
    actionMap.remove(LIST_FOCUS_ACTION_KEY);
    actionMap.remove(LIST_SELECTION_ACTION_KEY);
    actionMap.remove(LIST_SCROLL_ACTION_KEY_DOWN);
    actionMap.remove(LIST_SCROLL_ACTION_KEY_UP);

    InputMap inputMap = textComponent.getInputMap();
    inputMap.remove(KEY_STROKE_DOWN);//from   ww w .j  a  va2 s  .co m
    inputMap.remove(KEY_STROKE_UP);
    inputMap.remove(KEY_STROKE_PAGE_DOWN);
    inputMap.remove(KEY_STROKE_PAGE_UP);
    inputMap.remove(KEY_STROKE_ENTER);
    inputMap.remove(KEY_STROKE_TAB);

    inputMap.put(KEY_STROKE_DOWN, existingKeyStrokeDownAction);
    inputMap.put(KEY_STROKE_UP, existingKeyStrokeUpAction);
    inputMap.put(KEY_STROKE_PAGE_DOWN, existingKeyStrokePageDownAction);
    inputMap.put(KEY_STROKE_PAGE_UP, existingKeyStrokePageUpAction);
    inputMap.put(KEY_STROKE_TAB, existingKeyStrokeTabAction);
    inputMap.put(KEY_STROKE_ENTER, existingKeyStrokeEnterAction);

    textComponent.removeCaretListener(this);
}