RFR: 8365886: JSplitPane loses track of the left component when the component orientation is changed [v3]
Alan Snyder
javalists at cbfiddle.com
Fri Aug 29 03:05:34 UTC 2025
> On Aug 28, 2025, at 7:27 PM, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>
> I understand `ORIENTATION_PROPERTY` is supposedly meant for horizontal/vertical orientation change but what the code is doing on receipt of this PropertyChange event is exactly what we want it for ComponentOrientation change which is to update the layout manager components
>
> https://github.com/openjdk/jdk/blob/f423e1d9ad37135abacb8deb2d2151e21768a23e/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java#L2170-L2172
>
> https://github.com/openjdk/jdk/blob/f423e1d9ad37135abacb8deb2d2151e21768a23e/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java#L1204-L1211
>
> Moreover, `layoutManager` is protected field of `BasicSplitPaneUI` which is not accessible from JSplitPane
I think you have some choices
1. Generate an property change event that describes a change that did not happen (your current proposal)
2. Define a new property corresponding to the component orientation and generate that event
3. Find a way to allow JSplitPane to update the layout manager (e.g. by adding a public method to SplitPaneUI)
4. Stop caching the components in BasicSplitPaneUI, so that revalidate is sufficient [I don’t know if this is feasible]
By the way, I chose your solution for a workaround, but I think a bug fix can and should do better.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20250828/f107edbf/attachment.htm>
More information about the client-libs-dev
mailing list