void () { InputMap inputMap = getInputMap(WHEN_FOCUSED); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, false), "moveFocusDown"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false), "moveFocusUp"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false), "collapse"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false), "expand"); ActionMap actionMap = getActionMap(); actionMap.put("moveFocusDown", new MoveFocusAction(true)); actionMap.put("moveFocusUp", new MoveFocusAction(false)); actionMap.put("collapse", new ExpandAction(false)); actionMap.put("expand", new ExpandAction(true)); }