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....
Asked
Active
Viewed 1,294 times
1

svkvvenky
- 1,122
- 1
- 15
- 21
1 Answers
5
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.
-
@mKorbel I saw your reply and i am working on it....But i am unable to get exact output what i require.... – svkvvenky Jan 03 '12 at 08:06
-
here you can find_out some valuable examples http://www.java2s.com/Code/Java/Swing-JFC/CatalogSwing-JFC.htm, expanding this answer, maybe you are wrong, because there nobody made you job for you, only moving to correct dirrections, – mKorbel Jan 03 '12 at 08:40
-
[`TreeIconDemo2`](http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html#eg) is a good example, too. – Catalina Island Jan 03 '12 at 14:16