Article View: borland.public.jbuilder.java.swing
Article #9575Re: JSplitPane does not remember the divider
From: Paul Furbacher
Date: Tue, 29 Feb 2000 00:00
Date: Tue, 29 Feb 2000 00:00
35 lines
2432 bytes
2432 bytes
Nils-Erik Thorell wrote: > > Yes, I understand. But we have big problems with JScollPanes > inside a JSplitPane, and then JTrees inside the JScrollPane. > It is pure luck if the scrollbars show up when they should. > Setting the 'prefered sizes' of the JTrees seem to screw up the > scrollbars. It there any good guideline on how to program the > combination of these panes? Just using the 'Design' view in > JBuilder will not work. I have to edit the code manually, but > the is no guarantee that it will be robust since I don't know > whtat I am doing. Also, what about 'viewports' and should each > pane be in the constructor of the surrounding pane, etc, etc. ? > Anyway, just removing 'set prefered size' fixed the problems, > but I don't know why it works! You have to think in terms of the nesting involved and what the layout manager at each level will look at. The splitpane's layout manager will ask each of the scrollpane's for their preferred or minimum sizes. It won't dig into these containers because the insides of the scrollpanes: it just asks each container "based on what you've got inside you, what size do you want -- and DON'T tell me anything more. Similarly, the JScrollPane object's layout manager asks each component and container inside it what its preferred/minimum size is and won't dig into the insides of any container inside it. So, the long and short of it is that you set the minimum and preferred sizes of the scrollpanes and let the splitpane do its work. Pretty straightforward, actually. Just use the Property Inspector, select each scrollpane in turn, and set its minimum and preferred sizes. Don't tamper at all with the preferred sizes of the JTrees! Paul Furbacher (TeamB)
Technical Details
Message-ID:
<38BC422F.3EA8A82F@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38BA53F1.1799F1B6@es.sigma.se> <MPG.132533118c0249ed9897cb@forums.borland.com> <38BBF5DF.3C036179@es.sigma.se>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,797b2cd8aaf16ca9 X-Google-Attributes: gid111d45,public From: Paul Furbacher <pnf@home.com> Subject: Re: JSplitPane does not remember the divider Date: 2000/02/29 Message-ID: <38BC422F.3EA8A82F@home.com> X-Deja-AN: 591485958 Content-Transfer-Encoding: 7bit References: <38BA53F1.1799F1B6@es.sigma.se> <MPG.132533118c0249ed9897cb@forums.borland.com> <38BBF5DF.3C036179@es.sigma.se> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: pnf@home.com Newsgroups: borland.public.jbuilder.java.swing