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

Kirill Grouchnikov kirillcool at yahoo.com
Mon Jul 30 16:56:22 UTC 2007


It would help if the fixes were available from a public server...

----- Original Message ----
From: Mikhail Lapshin <Mikhail.Lapshin at Sun.COM>
To: swing-dev at openjdk.java.net
Sent: Monday, July 30, 2007 9:48:58 AM
Subject: <Swing Dev> A problem with initial location of JSplitPane divider




  
  

Hello everybody,



There is RFE
6528446: JSplitPane lacks of a method to set up the initial divider
location. 

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.
http://sa.sfbay.sun.com/projects/swing_data/7/6528446.0/

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:
http://sa.sfbay.sun.com/projects/swing_data/7/6528446.1/

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









      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20070730/8f35d7b1/attachment.html>


More information about the swing-dev mailing list