<Swing Dev> A problem with initial location of JSplitPane divider

Mikhail Lapshin Mikhail.Lapshin at Sun.COM
Mon Jul 30 17:29:46 UTC 2007


Kirill, thank you for the feedback.
Sorry for the internal links. I have attached the fixes as zip archives 
with html-based diffs and source files.

---------------

There is RFE 6528446: JSplitPane lacks of a method to set up the initial 
divider location 
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=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. (webrev6528446_v0.zip)
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. (webrev6528446_v1.zip)
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.

Thanks!
--Mikhail


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20070730/78992de2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: webrev6528446_v0.zip
Type: application/octet-stream
Size: 80329 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20070730/78992de2/webrev6528446_v0.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: webrev6528446_v1.zip
Type: application/octet-stream
Size: 193991 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20070730/78992de2/webrev6528446_v1.zip>


More information about the swing-dev mailing list