问题
I have created Jtree with Root node and 4Subnodes.
My problem is like this:
- I need to
change the foreground and background color of a particular node dynamically.
How can i do it?
Help me with some piece of code.
Thank you all in advance...
回答1:
How can i do it?
I'm sure that JTree tutorial contains valuable info about DefaultTreeCellRenderer,
Help me with some piece of code.
tons of examples here or here or here
回答2:
One easy way I found was to include HTML markup in the node text. The renderer (Windows 7, Java7.45) respects font color changes. Low-rent but gets the job done!
来源:https://stackoverflow.com/questions/8652862/change-the-color-of-one-or-more-nodes-in-jtree-dynamically