Hi!
Acording to the API docs on java.awt.Toolkit (which ImageIcon uses to load
an image from a filename) the format of the image can either be GIF, JPEG or
PNG. That is probably your problem, since you're trying to load
ICO-files....remember that the DefaultTreeCellRenderer is in fact a JLabel
and depending on the various flags to getTreeCellRendererComponent (ie. leaf
etc.) the renderer will choose the right image and set it with setIcon(). I
may be wrong but it works for me with gifs as foldericons - I think the
naming is a little missleading though...
Sincerely yours,
Pierre Jakobsen
> -----Oprindelig meddelelse-----
> Fra: Kirubakaran-S [SMTP:[EMAIL PROTECTED]]
> Sendt: 18. april 2001 23:05
> Til: [EMAIL PROTECTED]
> Emne: Trouble loading custom icons in a JTree
>
> Hi All,
> I am developing a swing application using JDK 1.3. I have created a
> JTree and I have written these lines of code to change the icons shown in
> the tree.
>
> DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() ;
>
> renderer.setLeafIcon(new ImageIcon("leaf.ico")) ;
> renderer.setClosedIcon(new ImageIcon("closed.ico")) ;
> renderer.setOpenIcon(new ImageIcon("open.ico")) ;
>
> tree.setCellRenderer(renderer) ;
>
>
> The above lines were taken from the Sun Java Tutorial. The icons are in
> the same directory in which the .java and .class files exists. What is the
> problem? The default icons are not displayed but these icons are also not
> displayed.
>
> Can anyone help me in this matter.
>
> waiting for a reply.
>
> --------------------------------------------------------------------------
> -----
> Kirubakaran S
> NCST
>
> Mail me at:
> ===========
> [EMAIL PROTECTED]
>
>
>
> _______________________________________________
> Swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/swing
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing