RFR: 8356594: JSplitPane loses divider location when reopened via JOptionPane.createDialog() [v2]
Sergey Bylokhov
serb at openjdk.org
Wed May 21 02:33:52 UTC 2025
On Tue, 20 May 2025 04:34:36 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> The issue is when a JSplitPane is embedded inside a lazily-initialized panel, and this panel is displayed using a dialog created via JOptionPane.createDialog(), the divider location is not preserved when reopening the dialog.
>> This is because when we added support for ComponentOrientation for JSplitPane, even though the left and right compoent is drawn the divider location is not set and was set to initial value and not to the value set by user.
>> Fixed by setting the divider location before rendering the left and right components..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Click position fixed..L&F iteration
> This is because when we added support for ComponentOrientation for JSplitPane, even though the left and right compoent is drawn the divider location is not set and was set to initial value and not to the value set by user.
It seems a bit inconsistent: on one hand the bug description says that the initial value is used and the value set by the user is ignored but on the other hand, the fix just resets the same value to itself. Could you clarify how this change addresses the issue:
`+ this.setDividerLocation(this.getDividerLocation());`
I have found that for some reason an incorrect value is being set from `BasicSplitPaneUI$BasicHorizontalLayoutManager.layoutContainer`. Could it be that this class incorrectly initializes the dividerLocation to the initial value instead of using the one set by the user?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25294#issuecomment-2896302804
More information about the client-libs-dev
mailing list