Article View: borland.public.jbuilder.java.swing
Article #7571Re: JTree in JScrollPane
From: Thomas G�lden
Date: Fri, 19 Jan 2001 15:14
Date: Fri, 19 Jan 2001 15:14
62 lines
2571 bytes
2571 bytes
Torsten,
Meanwhile I found a solution to my problem. In order to have the scrollpane
scrolled so that all childs of a node become visible when expanded, I have
set the following two parameters:
objTree.setExpandsSelectedPaths(true);
objTree.setToggleClickCount(1);
where objTree is a JTree component.
I still do not understand, why objTree.setScrollsOnExpand(true) would not
work as well, to get the anticipated behaviour.
Thanks for the help.
Regards
Thomas
Thomas.Guelden@t-online.de
"Thomas G�lden (p)" <Thomas.Guelden@t-online.de> schrieb im Newsbeitrag
news:947t22$55b7@bornews.inprise.com...
> I have problems realizing that when opening a node in a tree, which is
> placed in a JScrollPane, the scrollpane scrolls so that all child nodes
are
> visible.
>
> I use basically the following code:
>
> JTree tree = new JTree;
> ...
> JScrollPane pane;
>
>
> in JbInit():
>
> pane = new JScrollPane(tree);
> ...
> tree.setScrollOnExpand(true);
> ...
>
> This code does not lead to automatic scrolling when a node is expanded and
> the child are out of view (ath the bottom).
>
> Strangely also that in the Designer component tree in the JBuilder IDE,
tree
> is no a child of pane.
>
> So I do not know what is wrong with my code. I would be glad if somebody
> could provide some working sample code for this particular problem.
>
> Thanks in advance and kind regards.
>
> Thomas G�lden
>
> Thomas.Guelden@t-online.de
>
>
>
>
Technical Details
Message-ID:
<949lfs$k39$1@isp-m-srv06.izb.net>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!news-FFM2.ecrc.net!news.izb.net!not-for-mailReferences:
<947t22$55b7@bornews.inprise.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,d328df32c92f513a X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-19 07:21:32 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!news-FFM2.ecrc.net!news.izb.net!not-for-mail From: "Thomas G�lden" <Thomas.Guelden@gla.bayern.de> Newsgroups: borland.public.jbuilder.java.swing Subject: Re: JTree in JScrollPane Date: Fri, 19 Jan 2001 16:14:58 +0100 Organization: IZB - Internet News Service Lines: 64 Message-ID: <949lfs$k39$1@isp-m-srv06.izb.net> References: <947t22$55b7@bornews.inprise.com> NNTP-Posting-Host: 212.34.74.75 X-Trace: isp-m-srv06.izb.net 979917116 20585 212.34.74.75 (19 Jan 2001 15:11:56 GMT) X-Complaints-To: abuse@izb.net NNTP-Posting-Date: 19 Jan 2001 15:11:56 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400