wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Different Icons for JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Different Icons for JTree" Watch "Different Icons for JTree" New topic
Author

Different Icons for JTree

Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
I know that i can generally replace idons in a jtree for leaves, open, closed etc. but can I have specific icons for specific nodes/leaves? In otherwords, is it possible that in a large tree each item could be graphically represented in a different way (not just the three basic ways that are given)? An example might be an athletic association where they would want to represent each team on the 'tree' by their mascot. If possible, how would you do this. Can this be set in the node or is it set in the tree?
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
It is handled by the renderer.


bitguru blog
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Originally posted by Brian Cole:
It is handled by the renderer.

I'd modify the body just slightly:

Because you are now assuming behaviour (the return this part) that might someday change.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
jQuery in Action, 2nd edition
 
subject: Different Icons for JTree
 
Similar Threads
JTree
Dynamic JTree Components
Help with Jtree
Help with Jtree
JTree