I created a JTree. I need to change icon for specific node. Able to setIcon for closed and open as well as leafnodes but I need to set icon for specified node in my JTree. Please shed some light on this.
I created a JTree . I need to change icon for specific node. Able
Share
If you know how to change the default Icon, you know this happens in the TreeCellRenderer.
You can simply implement a TreeCellRenderer of your own that has more advanced determining of the icon than the DefaultTreeCellRenderer.
Something like this :
This basically delegates default behavior to DefaultTreeCellRenderer, but overrides the Icon if your special condition is true.