Article View: borland.public.jbuilder.java.language
Article #8065Re: JTrees -- how to programmatically expand one?
From: Olivier Morris
Date: Mon, 23 Apr 2001 17:31
Date: Mon, 23 Apr 2001 17:31
34 lines
2057 bytes
2057 bytes
this works for me in a situation where I'm adding a node and then having the list show its addition by expanding the tree... TreeNode[] nodes = model.getPathToRoot(n); // where n = my new DefaultMutableTreeNode TreePath path = new TreePath(nodes); tree.maekVisible(path); HTH Oli "Ken Warner" <kwarner@cts.com> wrote in message news: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 > >
Technical Details
Message-ID:
<VGZE6.2429$Tv2.220632@news6-win.server.ntlworld.com>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!news-xfer.nuri.net!enews.sgi.com!diablo.netcom.net.uk!netcom.net.uk!nntp.news.xara.net!xara.net!gxn.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mailReferences:
<3AE43B8F.1729735A@cts.com>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-23 10:40:05 PST Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!news-xfer.nuri.net!enews.sgi.com!diablo.netcom.net.uk!netcom.net.uk!nntp.news.xara.net!xara.net!gxn.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "Olivier Morris" <Olivier.Morris@Ntlworld.com> Newsgroups: borland.public.jbuilder.java.language References: <3AE43B8F.1729735A@cts.com> Subject: Re: JTrees -- how to programmatically expand one? Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: <VGZE6.2429$Tv2.220632@news6-win.server.ntlworld.com> Date: Mon, 23 Apr 2001 18:31:48 +0100 NNTP-Posting-Host: 213.107.34.98 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 988047157 213.107.34.98 (Mon, 23 Apr 2001 18:32:37 BST) NNTP-Posting-Date: Mon, 23 Apr 2001 18:32:37 BST Organization: ntl Cablemodem News Service