🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #311

Re: Collapse a JTree

#311
From: Arthur Ore
Date: Fri, 29 Jul 2005 23:23
40 lines
1876 bytes
Hi Magnus,

I was hoping someone more knowledgeable than me would answer, as I never did 
quite figure out why this works, but it does seem to work for me.

tree.collapsePath(top);
tree.updateUI();

Arth


"Magnus" <magnus_bjorkman@iwon.com> wrote in message 
news:42e8f26e$1@newsgroups.borland.com...
> Hi,
>
> I have a problem to "clear my tree".
>
> Typical tree (visible as is):
>
> top --- node1 --- leaf1
>     |          |- leaf2
>     |
>     |-- node2 --- leaf3
>                |- leaf4
>
> User has node1 selected and click a RadioButton.
> Now I want to collapse the tree so that top and node1 and node2 are 
> visible.
>
> I have tried with:
>       TreePath top = tree.getPathForRow(1);
>       tree.fireTreeCollapsed(top);
>       tree.setSelectionRow(0);
>
> Problem is that leaf3 & 4 are still visible
>
> If I try with row=0 only top is visible. I then tried to expand on row=1 
> but nothing happened.
>
> Any hints? 
Technical Details
Message-ID: <42eaba53@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42e8f26e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,ee6bedc9e28b1fb3
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Arthur Ore" <nospamthx_arthur@nospamthx.co.uk>
Newsgroups: borland.public.jbuilder.java.swing
References: <42e8f26e$1@newsgroups.borland.com>
Subject: Re: Collapse a JTree
Date: Sat, 30 Jul 2005 00:23:06 +0100
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
NNTP-Posting-Host: 82.69.65.131
Message-ID: <42eaba53@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1122679379 82.69.65.131 (29 Jul 2005 16:22:59 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail