🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: DefaultMutableTreeNode.setUserObject - newbie question

#12716
From: Richard Wilkman
Date: Fri, 06 Nov 1998 00:00
43 lines
1957 bytes
Carla:

When you change the user object of the root node the record in the
child that says who the parent object is no longer in synch.

For example, you have a tree A -> B -> C

B knows that it's parent is A.  You change A to Z, but B still thinks
it's parent is A so there are no children on Z.

Try iterating through the child objects and storing them off to the
side temporarily.  Then you change the root node and go through the
children and make the new node their parent.

-Rich

Carla Kessler wrote:
> 
> I am trying to do the simplest thing with tragic results...I have a JTree
> and I want to change the root node's text string. When I do so, using
> setUserObject, all of the children disappear.
> 
> Can anyone tell me what I am doing wrong? I would like to be able to alter
> the text for the node without destroying the children.
> 
> Thanks in advance for any help.
> 
> Carla

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <36435176.E64D1066@inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <70on40$nb36@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,4fc29c7e6f0e774c
X-Google-Attributes: gid111d45,public
From: Richard Wilkman <rwilkman@inprise.com>
Subject: Re: DefaultMutableTreeNode.setUserObject - newbie question
Date: 1998/11/06
Message-ID: <36435176.E64D1066@inprise.com>
X-Deja-AN: 409126064
Content-Transfer-Encoding: 7bit
References: <70on40$nb36@forums.borland.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing