RFR: 8356594: JSplitPane loses divider location when reopened via JOptionPane.createDialog() [v5]
Sergey Bylokhov
serb at openjdk.org
Mon Jun 2 20:11:57 UTC 2025
On Wed, 28 May 2025 03:21:45 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:
>
> Store current orientation for check
You need to clarify and verify a few things:
- When should the notification be sent?
Currently, we fire the event before completing the orientation swap. Would not it make more sense to do this after all components have been added/removed?
- What should happen if the application explicitly calls setComponentOrientation() to change the orientation?
In this case, how should we handle the divider location?:
1. Reset the divider to its default position.
2. Reflect/mirror the divider location based on the new orientation.
3. Preserve the current divider position as-is.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25294#issuecomment-2932307305
More information about the client-libs-dev
mailing list