Article View: borland.public.jbuilder.java.swing
Article #10698Re: Setting image icons for the leaf nodes of JTree
From: Paul Furbacher [TeamB]
Date: Thu, 19 Aug 1999 00:00
Date: Thu, 19 Aug 1999 00:00
27 lines
1502 bytes
1502 bytes
Chitra Amarnath wrote:
> 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.
The image folder has to be at the end of the package path of
the class in which the above code appears. So, if your frame
in which this tree is instantiated looks like this
package myPackage1.myPackage2;
you have to place the images where your __classes__ are
deployed (not where your source files are found):
..\myPackage1\myPackage2\images\smile.gif
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<37BC9337.2487ADB3@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<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: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu> Subject: Re: Setting image icons for the leaf nodes of JTree Date: 1999/08/19 Message-ID: <37BC9337.2487ADB3@bilbo.bio.purdue.edu> X-Deja-AN: 514883912 Content-Transfer-Encoding: 7bit References: <37BC285C.1EB05EA1@enterpriseworks.com> Content-Type: text/plain; charset=us-ascii Organization: Reverse Alchemy, Inc. Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu Newsgroups: borland.public.jbuilder.java.swing