A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Swing / AWT / SWT
How to set Icons in the JTree
Joined: Dec 14, 2011
Dec 15, 2011 10:36:12
I have a problem here. I'm implementing a
, but now I need set icons in each node.
I have searched about this, but I don't undestand very well how to do this.
Can someone help me? Please!
Joined: Jan 21, 2011
Dec 15, 2011 11:04:01
All you need is a TreeCellRender.
I have posted a very simple example for you here
Joined: Oct 27, 2005
Dec 15, 2011 13:10:58
There's no need to override
. It has its own methods to set the icons for opened nodes, closed nodes and leaf nodes. Just create an instance, set the right icons, and set that instance as the renderer.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: How to set Icons in the JTree
Jtree multiple icons
Different Icons for JTree
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015