Component (JList<? extends T> list, T value, int index, boolean isSelected, boolean cellHasFocus) { mySelected = isSelected; myForeground = UIUtil.getTreeForeground(); mySelectionForeground = cellHasFocus ? list.getSelectionForeground() : UIUtil.getTreeForeground(); clear(); setFont(UIUtil.getListFont()); putClientProperty(ITEM_PROPERTY, value); ListItemPresentation itemPresentation = null; try { itemPresentation = myPresentations.get(index); } catch (IndexOutOfBoundsException e) { LOG.error("No presentation for list item " + value, e); } if (itemPresentation != null) { setIcon(itemPresentation.icon); } String itemText = itemPresentation != null ? itemPresentation.text : IdeBundle.message("progress.text.loading"); append(itemText); try { doCustomizeCellRenderer(this, list, value, index, isSelected, cellHasFocus); } catch (IndexNotReadyException ignored) { // ignore } Color bg = UIUtil.getTreeBackground(isSelected, cellHasFocus); if (!isSelected) { Color bgColor = itemPresentation == null ? null : itemPresentation.backgroundColor; bg = bgColor == null ? bg : bgColor; } setBackground(bg); if (hasChildren(value)) { final JComponent rendererComponent = this; JPanel result = new JPanel(new BorderLayout()) { @Override public String getToolTipText(MouseEvent event) { return rendererComponent.getToolTipText(event); } }; result.getAccessibleContext().setAccessibleName(itemText); JLabel childrenLabel = new JLabel(); childrenLabel.setOpaque(true); childrenLabel.setVisible(true); childrenLabel.setBackground(bg); final boolean isDark = ColorUtil.isDark(UIUtil.getListSelectionBackground(true)); childrenLabel.setIcon(isDark ? AllIcons.Icons.Ide.NextStepInverted : AllIcons.Icons.Ide.NextStep); result.add(this, BorderLayout.CENTER); result.add(childrenLabel, BorderLayout.EAST); return result; } return this; }