Article View: borland.public.jbuilder.java.swing
Article #1428Re: TreePath positioning
From: Tad Frysinger [TeamB]
Date: Wed, 12 Nov 2003 02:26
Date: Wed, 12 Nov 2003 02:26
36 lines
2259 bytes
2259 bytes
Ruben Misrahi wrote: > Just to qualify my question: > I know that jTree1.getSelectionPath(treePath1) and > jTree1.setSelectionPath(treePath1) do the job. > > My problem is that after I modify the TreeModel model, for some reason I > need to de-assign: jTree1.setModel(null) and re-assign it to the modified > model: jTree1.setModel(treeModel1). > Then calling jTree1.setSelectionPath(treePath1) won't do the job. > > I should have explained this better. > > > "Ruben Misrahi" <sofsoft@lek.net> wrote in message > news:3fa96b4e@newsgroups.borland.com... > >>Is it possible to position on a specific JTree node using a TreePath? >> >>I'm assuming that if such a thing exists, the node in the JTree would need >>to be expanded automatically. >> >> >>Anyone? >> >> > > > You don't need to reassign the model, you need to tell the tree that the model structure has changed. Note that a TreePath object that was valid before may not be valid after that model change. If you have a reference to the node, you can get the path to that node from the adjusted TreeModel. -- Tad Frysinger [TeamB]
Technical Details
Message-ID:
<3fb19a77@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fa96b4e@newsgroups.borland.com> <3fa9c5c9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,ab6991c986d95e54 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-11-11 18:39:38 PST Date: Tue, 11 Nov 2003 19:26:29 -0700 From: "Tad Frysinger [TeamB]" <tfrysinger@earthlink.net> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: TreePath positioning References: <3fa96b4e@newsgroups.borland.com> <3fa9c5c9@newsgroups.borland.com> In-Reply-To: <3fa9c5c9@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.165.213.196 Message-ID: <3fb19a77@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1068604023 67.165.213.196 (11 Nov 2003 18:27:03 -0700) Lines: 37 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail