On 20 Jul 2001 19:08:54 +0530, Pradeep, Chinnaswamiah wrote:
> Hi ,
>
> Is there a method to display a node as a folder even if the folder contains
> no subfolders or files (nodes) ?
> If a folder contains no subfolders or nodes the folder appears as a node
> in the JTree. How can I change the look of this to folder ? Any specific
> function in the API or workarounds would be appreciated.
I presume you are writing a file manager here.
The problem is that the definition of a leaf is a node with no
children... What you need is a custom tree renderer which can examine
the data it has been asked to draw, and then draw the appropriate icon
for the type of file.
You'll probably be able to get away with subclassing the default
renderer, but I'd have a look at the source for... inspiration on how to
code the renderers. There are several little tricks which are handy to
speed Swing up.
Ross
--
Ross Burton Software Engineer
OneEighty Software Ltd Tel: +44 20 8680 8712
Cygnet House Fax: +44 20 8680 8453
12-14 Sydenham Road [EMAIL PROTECTED]
Croydon, Surrey CR9 2ET, UK http://www.180sw.com./
====================================================================
Under the Regulation of Investigatory Powers (RIP) Act 2000 together
with any and all Regulations in force pursuant to the Act OneEighty
Software Ltd reserves the right to monitor any or all incoming or
outgoing communications as provided for under the Act
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing