Article View: borland.public.jbuilder.java.swing
Article #7534Re: JTree - expanding multiple levels
From: Martin Andersson
Date: Wed, 17 Jan 2001 10:33
Date: Wed, 17 Jan 2001 10:33
30 lines
1822 bytes
1822 bytes
Try using the scrollPathToVisible() method eg:
...
DefaultMutableTreeNode parent = new DefaultMutableTreeNode("parent");
DefaultMutableTreeNode child = new DefaultMutableTreeNode("child");
parent.add(child);
jTree.scrollPathToVisible(new TreePath(child.getPath()));
/Cheers Martin
"Ali Demir" <demir.4@osu.edu> wrote in message news:3a1074ca$1_2@dnews...
> I am trying to automatically expand the child nodes when the user clicks
and
> expands a parent node.
>
> On treeExpanded event handler, I try to expand the children using
expandPath
> for each of them. Nothing happens.
>
> Before the parent is expanded, its children's children are not loaded, but
> children's isLeaf() methods report false; Thus, in the treeExpanded event
> handler, I do load the children's children and they are available to be
> displayed.
>
> Has anyone ever tackled with a problem like this? I will appreciate any
> ideas, examples, tips. Thank you.
> Ali.
>
>
Technical Details
Message-ID:
<943s96$au61@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mailReferences:
<3a1074ca$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,182e05e01b8f6cb3 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-17 02:34:07 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail From: "Martin Andersson" <b97maran@student.his.se> Newsgroups: borland.public.jbuilder.java.swing Subject: Re: JTree - expanding multiple levels Date: Wed, 17 Jan 2001 11:33:15 +0100 Organization: Another Netscape Collabra Server User Lines: 32 Message-ID: <943s96$au61@bornews.inprise.com> References: <3a1074ca$1_2@dnews> NNTP-Posting-Host: 193.10.185.3 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