🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #459

Re: Icons with JTree

#459
From: John McGrath [TeamB]
Date: Wed, 06 Apr 2005 23:41
31 lines
2194 bytes
On 4/6/2005 at 10:04:10 AM, Magnus wrote:

> I have read two good tutorials on how to use JTree 

First, this question concerns Swing and not the Java language, so I have
set follow-ups to borland.public.jbuilder.java.swing.

> Now I would like to do the following:  1) Different icons for the leaf
> depending on what "type" the leaf represents. (i.e. in one example with
> books i want a different icon if the book (leaf) is in a specific
> language).

You can create a TreeCellRenderer to display the JTree cell however you
want it.

> 2) This would then "carry" over to the node node so if the node has a
> leaf with all books in one language to show that with a specific icon
> (i.e. if it is only English books under that node to show a "flag-icon")
> and if it is a mix of languages (i.e. a "?-icon")

You need to write the code to determine what icon should be shown.  To
draw the icon you want, see #1.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <xn0e0oqow4ubro7007@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4253ec5e$2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,3caa501e63d3c120
X-Google-Thread: 111d45,13f17f13d549b26c,start
X-Google-Attributes: gidf74b3,gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "John McGrath  [TeamB]" <ng-b@JPMcGrath.net>
Subject: Re: Icons with JTree
Newsgroups: borland.public.jbuilder.java.language,borland.public.jbuilder.java.swing
Followup-To: borland.public.jbuilder.java.swing
References: <4253ec5e$2@newsgroups.borland.com>
User-Agent: XanaNews/1.17.3.1
Message-ID: <xn0e0oqow4ubro7007@newsgroups.borland.com>
X-Ref: newsgroups.borland.com ~XNS:0000036D
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
NNTP-Posting-Host: 141.158.34.89
Date: 6 Apr 2005 15:41:57 -0800
X-Trace: newsgroups.borland.com 1112827317 141.158.34.89 (6 Apr 2005 15:41:57 -0800)
Lines: 31
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail