🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10617

Re: Setting image icons for the leaf nodes of JTree

#10617
From: Tad Frysinger
Date: Fri, 20 Aug 1999 00:00
25 lines
1388 bytes
In article <37BC285C.1EB05EA1@enterpriseworks.com>, 
chitra.amarnath@enterpriseworks.com says...
> Hi,
> 
> I have a jtree component with all the child nodes set. I am trying to
> set the icons for the leaf nodes to an image file where the code looks
> like this 
> 
> DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
> renderer.setLeafIcon(new ImageIcon("images/smile.gif"));     
> tree.setCellRenderer(renderer);
> 
> I have the image file under the webserver root directory. But for some
> reason it doesn't show the image icon on the leaf nodes. 
> 
> I would really appreciate any help in this regard.
> 
> Chitra
> 
It is best to load images ahead of time, and make sure they are done 
loadig before the node attempts to display the first time.  Make very 
sure your path information is correct, or it won't find the image and you 
will have a null imageIcon.

Tad Frysinger (TeamB)
Technical Details
Message-ID: <MPG.12270ba4b76b3d3a989694@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37BC285C.1EB05EA1@enterpriseworks.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,aeb0d0541489f502
X-Google-Attributes: gid111d45,public
From: tfrysinger@earthlink.net (Tad Frysinger)
Subject: Re: Setting image icons for the leaf nodes of JTree
Date: 1999/08/20
Message-ID: <MPG.12270ba4b76b3d3a989694@forums.borland.com>
X-Deja-AN: 515113122
References: <37BC285C.1EB05EA1@enterpriseworks.com>
Organization: RTOne
Newsgroups: borland.public.jbuilder.java.swing