My problem is like this:
I have a tree with root and 4 leafnodes.
I need to change icon of a particular node (say 2nd leaf node).

My algorithm is like this:
step 1: Find index of the required node
Step2:Change its icon
I am done with step 1,but strucked at step 2.
Please help me out....

Thank you all in advance....

有帮助吗?

解决方案

If I am correctly understanding what you mean, you should have your answer in the link below. If you have the icon you want to change, just create an instance of the DefaultTreeCellRenderer and go from there. You can also use different lines for collapsing and expanding. Follow the steps on the link I am providing from Oracle.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top