File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How to set Images for the leaf nodes in the Jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to set Images for the leaf nodes in the Jtree" Watch "How to set Images for the leaf nodes in the Jtree" New topic
Author

How to set Images for the leaf nodes in the Jtree

Nanditha Parripati
Greenhorn

Joined: Jul 20, 2009
Posts: 12
Hi Guys,

I created a Jtree with Hashtable. But i want to set different images for leaf nodes in the Jtree How do i do that. Please any one help me in this.
Gert-Jan den Besten
Ranch Hand

Joined: May 02, 2008
Posts: 56

I wonder to what kind of SCJD assignment this applies to


SCJP 5; SCJD; SCWCD 5.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5451
    
  13

Gert-Jan,

Sometimes people have some difficulties finding the correct forum to post their question So one of the bartenders or sheriffs (people with special powers) will move it to the Swing / AWT / SWT / JFace forum.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11490
    
  95

So moved.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You'll need to supply your own TreeRenderer.

http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#display


GenRocket - Experts at Building Test Data
 
jQuery in Action, 2nd edition
 
subject: How to set Images for the leaf nodes in the Jtree