JComponent (@NotNull NavBarPanel panel, Object @NotNull [] siblings) { final class MyListRenderer implements ListCellRenderer<Object> { final List<SelectablePanel> selectables = new ArrayList<>(); @Override public Component getListCellRendererComponent(JList<?> list, Object obj, int index, boolean isSelected, boolean cellHasFocus) { if (panel.isDisposed()) { // Don't create new NavBarItem if panel is disposed. See: IDEA-306495 //noinspection MissingAccessibleContext return new SelectablePanel(); } SelectablePanel selectable = null; for (SelectablePanel cachedSelectable : selectables) { NavBarItem item = unwrapItem(cachedSelectable); if (obj == item.getObject()) { item.update(); selectable = cachedSelectable; } } if (selectable == null) { selectable = SelectablePanel.wrap(new NavBarItem(panel, obj, null, true)); if (ExperimentalUI.isNewUI()) { selectable.setSelectionArc(JBUI.CurrentTheme.Popup.Selection.ARC.get()); } selectables.add(selectable); } selectable.setBackground(null); selectable.setSelectionColor(isSelected ? UIUtil.getListSelectionBackground(cellHasFocus) : null); return selectable; } } final class MyList<E> extends JBList<E> implements DependentTransientComponent, Queryable { @Override public void putInfo(@NotNull Map<? super String, ? super String> info) { panel.putInfo(info); } @Override public @NotNull Component getPermanentComponent() { return panel; } } JBList<Object> list = new MyList<>(); list.setModel(new CollectionListModel<>(siblings)); HintUpdateSupply.installSimpleHintUpdateSupply(list); MyListRenderer renderer = new MyListRenderer(); list.putClientProperty(DISPOSED_OBJECTS, renderer.selectables); list.setCellRenderer(renderer); list.setBorder(JBUI.Borders.empty(5)); list.setBackground(JBUI.CurrentTheme.Popup.BACKGROUND); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { panel.updatePopupSelection(list.getSelectedValuesList()); } }); NavBarListWrapper navBarListWrapper = new NavBarListWrapper(list); ListWithFilter<?> component = (ListWithFilter<?>)ListWithFilter.wrap(list, navBarListWrapper, o -> panel.getPresentation().getPresentableText(o, false)); navBarListWrapper.updateViewportPreferredSizeIfNeeded(); component.setAutoPackHeight(!UISettings.getInstance().getShowNavigationBarInBottom()); component.putClientProperty(JBLIST_KEY, list); OpenInRightSplitAction.Companion.overrideDoubleClickWithOneClick(component); return component; }