🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Help for JTree

#8511
From: Thomas G�lden
Date: Fri, 11 Aug 2000 00:00
38 lines
1954 bytes
I have created a tree without problems.

Now, I want the user be able to add childs to specific nodes via another
dialog, and have the tree updated to the new contents. Each path should
occur only once, that is if there exists a hierarchy like

Object1
    |--------Child1
    |--------Child2
    |                 |------Grandchild1
    |                 |------Grandchild2
    |
    |--------Child3
    |                  |------Grandchild1        <------ node in the example
should be inserted here
    |--------Child4
                       |------Grandchild1


and the user fills in a dialog textfields for the first, second and third
level, let's say Object1 - Child3 - Grandchild2 I would like the tree been
updated so that a new node is attached to Child3.
So far I could only manage to add a complete new path, so that Object1 and
Child3 are repeated.
In my code, I try first to figure out if Object1 already exists, if so I
would look for Grandchild3 and so on. But I cannot figure out if nodes
already exist. There must be away to do it. I do not want to select the
nodes I am looking for, I rather look for something like

boolean   exists(TreeNode node)

I am probably completely on the wrong path... So if somebody could point me
at how to insert nodes at a certain place in a tree most easily ?

Thanks for help

Thomas G�lden
Thomas.Guelden@t-online.de
Technical Details
Message-ID: <8mv9ef$4fs9@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,f113b0aa58d2bd2a,start
X-Google-Attributes: gid111d45,public
From: "Thomas G�lden" <Thomas.Guelden@t-online.de>
Subject: Help for JTree
Date: 2000/08/11
Message-ID: <8mv9ef$4fs9@bornews.borland.com>
X-Deja-AN: 656938804
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
Organization: Bayerisches Geologisches Landesamt
X-MSMail-Priority: Normal
Reply-To: "Thomas G�lden" <Thomas.Guelden@t-online.de>
Newsgroups: borland.public.jbuilder.java.swing