🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: adding a node to a JTree

#1147
From: Alan Shiers
Date: Wed, 17 Mar 2004 17:23
40 lines
2543 bytes
> There are some unknowns here, so I'm going
> to do some guessing.
>
> If I browse JFileChooser, I don't find
> any reference to "treepath".  Are we dealing
> with a Save As dialog of your own crafting?

Yes, that is the case.

>
> Also, I notice that you commented out
>
>    jTree1.setSelectionPath(path);

I only commented it out because it didn't do what I had expected. I may
uncomment it if it helps to achieve the end result.  I was simply hoping
there was a method I could call that, given the TreePath object, would
simply automatically select the desired node.  But that wasn't the case with
setSelectionPath(path).

>
> Is that because that didn't select anything,
> contrary to what you expected?  If so, that
> leads me to think that the tree path which
> you get back from the dialog is not filled
> with the same node objects as the ones in
> the tree you are trying to maintain.

The JTree in the SaveAs dialog box is identicle to the one on the main
interface, except that it shows only the directories, no leaf nodes.  So I
know that whatever node is chosen in the SaveAs dialog box, the same node
exists in the JTree on the main interface.  Once a node is chosen in the
SaveAs dialog box I capture the TreePath object and send it to an instance
variable in another class for retrieval by the method I was showing you
earlier.

Hope this helps clarify things,

Alan
Technical Details
Message-ID: <40588984$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-05!sn-xit-08!supernews.com!68.6.19.232.MISMATCH!west.cox.net!east.cox.net!filt01.cox.net!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40564bf4@newsgroups.borland.com> <405752b0@newsgroups.borland.com> <40577f00@newsgroups.borland.com> <405793e6$2@newsgroups.borland.com> <405853df$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,a760aeb930adb421
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2004-03-17 09:25:00 PST
From: "Alan Shiers" <ashiers@hfx.eastlink.ca>
Newsgroups: borland.public.jbuilder.java.swing
References: <40564bf4@newsgroups.borland.com> <405752b0@newsgroups.borland.com> <40577f00@newsgroups.borland.com> <405793e6$2@newsgroups.borland.com> <405853df$1@newsgroups.borland.com>
Subject: Re: adding a node to a JTree
Date: Wed, 17 Mar 2004 13:23:57 -0400
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 24.222.101.2
Message-ID: <40588984$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1079544196 24.222.101.2 (17 Mar 2004 09:23:16 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-05!sn-xit-08!supernews.com!68.6.19.232.MISMATCH!west.cox.net!east.cox.net!filt01.cox.net!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail