🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

JTree question

#28
From: Acid Steve
Date: Mon, 03 Aug 1998 00:00
19 lines
1644 bytes
Hi,
While using Swing1.0.3's JTree class, i ran into following problem:
adding Objects(new leafs or nodes) to to existing ones in a tree. The
catch is that Object must be added not to the selection, but to parent
Object.
To make a long story short, what i want to do is to add child to parent
knowing only parent Object and child Object (i don't mean adding to
DefaultMutableTreeNode). Parent of parent, etc. is also available. Since
function DefaulTreeModel.insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent, int index) needs MutableTreeNode, i haven't
found any way of getting the object of this type through the Object the
node was created. I doubt conversion (MutableTreeNode)parent, etc. can
do any good. So the only way it might be done is hashing
Object-MutableTreeNode pairs when any node is created. At least it's the
way i see it.
Hope there are some other ways, since this one is very expensive in
resource usage sense.

                                      Vladimir Olenin
Technical Details
Message-ID: <35C4E52F.2FD3BF76@hempseed.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3e44efe44e28da2b,start
X-Google-Attributes: gidf74b3,public
X-Google-Thread: ff01d,3e44efe44e28da2b,start
X-Google-Attributes: gidff01d,public
From: Acid Steve <acidsteve@hempseed.com>
Subject: JTree question
Date: 1998/08/03
Message-ID: <35C4E52F.2FD3BF76@hempseed.com>
X-Deja-AN: 377309881
Content-Transfer-Encoding: 7bit
X-Accept-Language: ru
Content-Type: text/plain; charset=koi8-r
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language,borland.public.jbuilder.applet-issues