RFR: 8356594: JSplitPane loses divider location when reopened via JOptionPane.createDialog() [v4]
Sergey Bylokhov
serb at openjdk.org
Wed May 28 02:40:58 UTC 2025
On Mon, 26 May 2025 02:38:43 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/JSplitPane.java line 373:
>>
>>> 371: public void setComponentOrientation(ComponentOrientation orientation) {
>>> 372: if (!orientation.equals(this.getComponentOrientation())) {
>>> 373: super.setComponentOrientation(orientation);
>>
>> I would like to bring up for discussion whether we should move this line outside the if block. From what I can tell, it was always executed before the initial fix, so this change might affect the original behavior.
>
> If we call setComponentOrientation in test (like in TestSplitPaneOrientationTest.java which was added for JDK-4265389) then this check would fail as ComponentOrientation object would change if we call super.setComponentOrientation outside the if block (that is because `setComponentOrientation `stores the passed orientation so `this.getComponentOrientation` would always be same as `orientation `after `super.setComponentOrientation `call) and so left/right component would not be set..
> Also, the initial fix didn't have the ComponentOrientation support so that code is anyway redundant..
But we can read/save orientation, then call super, then make a check?
I am not sure how important to always call super.setComponentOrientation(orientation);
can we miss some notification fired from that method?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25294#discussion_r2110762409
More information about the client-libs-dev
mailing list