Article View: borland.public.jbuilder.java.swing
Article #8804Re: how to programmatically expand the root node?
From: Vladimir Patt
Date: Thu, 13 Jul 2000 00:00
Date: Thu, 13 Jul 2000 00:00
24 lines
1286 bytes
1286 bytes
"M Le" <wildcard_mcl@hotmail.com> wrote in message news:396cb216@dnews...
> i'd like to programmatically expand the root node of a JTree after
> the tree has been initialized.
>
> i've tried
> jTree.expandPath(new TreePath(rootNode.getPath()));
> but that didn't do anything.
>
> i even tried fireTreeWillExpand with no luck.
There is bug in 1.2.2 which is claimed been fixed in 1.3. If you set Root to
be nonvisible, there is no chance to expand tree, sorry but can't remember
where I've read about it.
For me this peace of code works fine:
if ( isFirst ) {
for (int i = 0; i < myTree.getRowCount(); i++) {
myTree.expandRow(i);
}
myTree.setRootVisible(false);
}
Cheerse,
Vladimir,
Technical Details
Message-ID:
<396d6e2f@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<396cb216@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a89862566ef5832e X-Google-Attributes: gid111d45,public From: "Vladimir Patt" <vladimir@emc.co.il> Subject: Re: how to programmatically expand the root node? Date: 2000/07/13 Message-ID: <396d6e2f@dnews> X-Deja-AN: 645804229 References: <396cb216@dnews> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Trace: 13 Jul 2000 00:22:23 -0800, 127.0.0.1 Organization: EMC Israel X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing