void (ActionEvent e) { int selIndexBefore = getSelectedIndex(); defaultAction.actionPerformed(e); int selIndexCurrent = getSelectedIndex(); if (selIndexBefore != selIndexCurrent) return; if (focusNext && 0 == selIndexCurrent) return; KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Container container = kfm.getCurrentFocusCycleRoot(); FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); if (null == policy) policy = kfm.getDefaultFocusTraversalPolicy(); Component next = focusNext ? policy.getComponentAfter(container, PaletteComponentList.this) : policy.getComponentBefore(container, PaletteComponentList.this); if (next instanceof PaletteGroupHeader) { clearSelection(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(next, true)); ((PaletteGroupHeader)next).scrollRectToVisible(next.getBounds()); } }