Component (JTree tree, Object obj, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component result; Object userObject = ((DefaultMutableTreeNode)obj).getUserObject(); if (userObject instanceof SummaryNode) { myNodeRenderer.getTreeCellRendererComponent(tree, userObject.toString(), selected, expanded, leaf, row, hasFocus); myNodeRenderer.setFont(UIUtil.getTreeFont().deriveFont(Font.BOLD)); myNodeRenderer.setIcon(null); result = myNodeRenderer; } else if (userObject instanceof TodoItemNode && !((TodoItemNode)userObject).getAdditionalLines().isEmpty()) { myMultiLineRenderer.getTreeCellRendererComponent(tree, obj, selected, expanded, leaf, row, hasFocus); result = myMultiLineRenderer; } else if (userObject instanceof NodeDescriptor descriptor && userObject instanceof HighlightedRegionProvider regionProvider) { myColorTreeCellRenderer.getTreeCellRendererComponent(tree, obj, selected, expanded, leaf, row, hasFocus); for (HighlightedRegion region : regionProvider.getHighlightedRegions()) { myColorTreeCellRenderer.addHighlighter(region.startOffset, region.endOffset, region.textAttributes); } myColorTreeCellRenderer.setIcon(descriptor.getIcon()); result = myColorTreeCellRenderer; } else { result = myNodeRenderer.getTreeCellRendererComponent(tree, obj, selected, expanded, leaf, row, hasFocus); } ((JComponent)result).setOpaque(!selected); return result; }