🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTree: how can I make a childless node non-leaf

#13053
From: Gregg Sirrine
Date: Tue, 29 Sep 1998 00:00
16 lines
1256 bytes
Frode Oldervoll wrote in message <6tlprd$rv12@forums.borland.com>...
>I want to make a childless node in a JTree a non-leaf, because I want to
add
>leafs to the node at runtime. How can I do this? I have tried to use
>setAllowsChildren(true), but the childless nodes still becomes leaf nodes.


When you create your tree model use the constructor:

public DefaultTreeModel(TreeNode rootNode, boolean asksAllowsChildren)

and set the asksAllowsChildren flag to true. Then you must also override the
getAllowsChildren()function in your tree model implementation. When the tree
control is drawn it will call your getAllowsChildren()  function and you
must determine if the node in question should be displayed as a leaf.
Technical Details
Message-ID: <6urj6i$o8e4@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6tlprd$rv12@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,e9d41362ca1830e1
X-Google-Attributes: gid111d45,public
From: "Gregg Sirrine" <gsirrine@waterford.org>
Subject: Re: JTree: how can I make a childless node non-leaf
Date: 1998/09/29
Message-ID: <6urj6i$o8e4@forums.borland.com>
X-Deja-AN: 396116296
References: <6tlprd$rv12@forums.borland.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing