Article View: borland.public.jbuilder.java.language
Article #8085Re: JTrees -- how to programmatically expand one?
From: Ken Warner
Date: Tue, 24 Apr 2001 14:44
Date: Tue, 24 Apr 2001 14:44
47 lines
2091 bytes
2091 bytes
Torsten, Figured it out...thanks. Building the right path was the problem. And many of the methods that are needed for path building are in DefaultMutableTreeNode -- which was the last place I looked for those methods. I was looking in TreeModel and TreePath -- stupid me! Torsten Welches wrote: > Ken, > > try: > tree.setSelectionPath(new TreePath(node.getPath())); > > you need to setExpandsSelectedPaths(true), which is the default anyway I > guess. > > Torsten > > Ken Warner schrieb in Nachricht <3AE43B8F.1729735A@cts.com>... > >Hi, > > > >I have a JTree in a JScrollPane. It is a three level pain -- ooops -- I > >mean tree. > > > >I want to expand to a particular node. I know what node I want to > >expand to. > >How do I use that node to expand the tree? The tree starts completely > >collapsed > >so that only the root node is showing. There are 9 "middle" nodes and > >those > >9 middle nodes can have from 0 to 200 leaf nodes. > > > >I want to expand the tree to a particular leaf node. > > > >Pointers? Thoughts? *CODE*? > > > >-- > >Ken Warner > > > > -- Ken Warner
Technical Details
Message-ID:
<3AE59137.54E4BA63@cts.com>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!howland.erols.net!sunqbc.risq.qc.ca!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!KWeb!dnewsReferences:
<3AE43B8F.1729735A@cts.com> <3ae46ba3_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,942cde4f8053c1d0 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-24 09:52:02 PST Message-ID: <3AE59137.54E4BA63@cts.com> Date: Tue, 24 Apr 2001 09:44:07 -0500 From: Ken Warner <kwarner@cts.com> X-Mailer: Mozilla 4.73 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: JTrees -- how to programmatically expand one? References: <3AE43B8F.1729735A@cts.com> <3ae46ba3_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.120.8.121 X-Trace: dnews 988130637 216.120.8.121 (24 Apr 2001 09:43:57 -0700) Lines: 49 Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!howland.erols.net!sunqbc.risq.qc.ca!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!KWeb!dnews