🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTree question

#8052
From: Michael Rachow
Date: Tue, 21 Nov 2000 00:00
24 lines
1393 bytes
Hi Paolo,

for me it seems that one cannot create a TreePath object "again" and use it
for Selection on a tree.
I'm asking the tree for TreePath objects during it's (model) creation.

TreePath pathX;        // living outside here

        DefaultMutableTreeNode root  = new DefaultMutableTreeNode("root");
        DefaultMutableTreeNode parent;
        DefaultMutableTreeNode child;

        parent = new DefaultMutableTreeNode("parent");
        root.add(parent);
        child = new DefaultMutableTreeNode("child1");
        parent.add(child);
        child = new DefaultMutableTreeNode("child2");
        parent.add(child);
pathX = new TreePath(child.getPath());    // to get TreePath from root to
that current child.

Later i use that pathX for Selection.
It describes the whole path from root to child
pathX.toStrings shows something like [root, parent, child2]
Technical Details
Message-ID: <3a1aa625_1@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3a1a60ae_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,5b58b2db5f1670eb
X-Google-Attributes: gid111d45,public
From: "Michael Rachow" <mrachow@BeraCom.de>
Subject: Re: JTree question
Date: 2000/11/21
Message-ID: <3a1aa625_1@dnews>
X-Deja-AN: 696222716
References: <3a1a60ae_1@dnews>
X-Trace: 21 Nov 2000 08:43:17 -0800, 62.224.111.214
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.jbuilder.java.swing
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400