From 82331b08d1793b4e06cb129d07c779845cb2c83d Mon Sep 17 00:00:00 2001 From: weisj Date: Sat, 7 Nov 2020 17:45:37 +0100 Subject: [PATCH] Patch icon before requesting the renderer to ensure user-set icons aren't overwritten. --- .../darklaf/ui/tree/DarkTreeCellRendererDelegate.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRendererDelegate.java b/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRendererDelegate.java index 435ac660..94576e56 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRendererDelegate.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRendererDelegate.java @@ -60,10 +60,11 @@ public class DarkTreeCellRendererDelegate extends TreeCellRendererDelegate imple leaf, row, isFocused); renderer = prepareRendererComponent(tree, comp); } else { - renderer = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, isFocused); - if (renderer instanceof DefaultTreeCellRenderer) { - patchIcon(tree, (DefaultTreeCellRenderer) renderer, leaf, expanded); + TreeCellRenderer delegate = getDelegate(); + if (delegate instanceof DefaultTreeCellRenderer) { + patchIcon(tree, (DefaultTreeCellRenderer) delegate, leaf, expanded); } + renderer = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, isFocused); } CellUtil.setupTreeForeground(renderer, tree, selected); CellUtil.setupTreeBackground(renderer, tree, selected, row);