Hi,
How can I change the color of the node icons in a JTree?
I looked at DefaultTreeCellRenderer, but it only has methods for
changing the foreground and background colors of the text or outlining
the text. I couldn't find any methods that allow you to change the
color of the icons for the nodes. Is there such a thing? The only
other alternative I can think of is to actually change the icons.
Gil
Arnaud Berger - 22 Jun 2005 15:36 GMT
Hi,
You may want to make your own sublass of Icon (this is nothing though)
Regards,
Arnaud
> Hi,
>
[quoted text clipped - 7 lines]
>
> Gil
Vova Reznik - 22 Jun 2005 16:10 GMT
> Hi,
>
[quoted text clipped - 7 lines]
>
> Gil
You cannot change color of icon, but you can change icon itself.
Easiest way to put replace icon:
UIManager.put("Tree.leafIcon", yourNewIcon);
"Tree.closeIcon"
"Tree.collapsedIcon"
"Tree.expendedIcon"
"Tree.openIcon"
SwingUtilities.updateComponentTreeUI(yourTree);