<Swing Dev> A problem with initial location of JSplitPane divider
Mikhail.Lapshin at Sun.COM
Mon Jul 30 09:48:58 PDT 2007
There is RFE 6528446: JSplitPane lacks of a method to set up the initial
divider location <http://monaco.sfbay.sun.com/detail.jsf?cr=6528446>.
It is intended to solve the following problem: JSplitPane lacks for a
method to set up the initial divider location in terms of percents or
proportions. There is the setDividerLocation(double) method, but it
doesn't work unless the split pane is shown on the screen.
I wrote two fix versions, implementing two different ideas. However the
both ideas turned out not so good.
1. The first fix idea.
To modify the setDividerLocation(double) method in such a way, that it
can work even for a split pane in non-realized state. The method will
store the desirable proportionalLocation in a private field and then
apply it when the split pane becomes realized.
It turned out not so good because JSplitPane gets a new internal state,
which cannot be read with the existing API. For example, there is no any
possibility to read the stored divider location if the location was set
before the showing of the split pane.
2. The second fix idea:
To add a new API, which will allow to set the initial divider location.
It turned out not so good because it requires addition of three new API
methods to solve such small problem.
If you have a better idea how to implement the setting of the initial
divider location, I will be very grateful.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swing-dev