PlanetJava
Custom Search

java-netbeans-user-interface
[Top] [All Lists]

Re: Split Pane -> Getting equal pane sizes

Subject: Re: Split Pane -> Getting equal pane sizes
Date: Tue, 13 Feb 2007 08:54:39 -0600
appleGuy wrote:
yes ive tried to make both sides have panels that are the same size and
positions etc. Still doesnt seem to work.
How to you define the divider as static, what does it mean?..Does it mean I
cant change the divide by hand. If so I want to do this, but keep the
proportions (equal at start of window) the same all the way through a
resize.
I haven't seen all this discussion and I haven't tried the following, but this 
is what comes to mind for where to start.
There are two ways to specify the divider location on JSplitPane.  One is the 
absolute pixel position, the other is a floating point percentage.  By tracking 
the floating point percentage as the divider is moved, you can then know what 
percentage to use to position the bar on a resize.  I'd suggest that after 
installing a component listener to see the reshape start and end and making sure 
you understand that, then you should be able to do
// at some class level
double pos;
// When the divider location changes.
pos = jsp.getSize().width()/(double)jsp.getDividerLocation();
// As each resize happens
jsp.setDividerLocation(pos);
Gregg Wonderly
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy