Keymap km = JTextComponent.getKeymap(getKeymapName()); if (km == null) km = createKeymap(); textComponent.setKeymap(km);
textComponent.setKeymap(createKeymap());
  protected void installKeyboardActions()  {        // load key bindings for the older interface    Keymap km = JTextComponent.getKeymap(getKeymapName());    if (km == null)      km = createKeymap();    textComponent.setKeymap(km);    // load any bindings for the newer InputMap / ActionMap interface    SwingUtilities.replaceUIInputMap(textComponent, JComponent.WHEN_FOCUSED,                                     getInputMap(JComponent.WHEN_FOCUSED));    SwingUtilities.replaceUIActionMap(textComponent, createActionMap());        ActionMap parentActionMap = new ActionMapUIResource();    Action[] actions = textComponent.getActions();    for (int j = 0; j < actions.length; j++)      {        Action currAction = actions[j];        parentActionMap.put(currAction.getValue(Action.NAME), currAction);      }        SwingUtilities.replaceUIActionMap(textComponent, parentActionMap);  }