RFR: 4265389: JSplitPane does not support ComponentOrientation
Abhishek Kumar
abhiscxk at openjdk.org
Wed Jul 17 10:05:53 UTC 2024
On Wed, 17 Jul 2024 07:20:25 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> JSplitPane's support of CompoentOrientation is not present so if orientation is RTL, it still renders left component on left and right component on right instead of other way around..
> Fix to make it support RTL orientation
src/java.desktop/share/classes/javax/swing/JSplitPane.java line 362:
> 360: setLeftComponent(newLeftComponent);
> 361: if (newRightComponent != null)
> 362: setRightComponent(newRightComponent);
{ } should be there for single line if statement also. Applicable for L364 and L366.
Suggestion:
if (newLeftComponent != null) {
setLeftComponent(newLeftComponent);
}
if (newRightComponent != null) {
setRightComponent(newRightComponent);
}
test/jdk/javax/swing/JSplitPane/TestSplitPaneOrientationTest.java line 39:
> 37: public class TestSplitPaneOrientationTest {
> 38: private static JButton leftOneTouchButton;
> 39: private static JButton rightOneTouchButton;
Unused variables.
test/jdk/javax/swing/JSplitPane/TestSplitPaneOrientationTest.java line 60:
> 58: JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
> 59: new JButton("Left"), new JButton("Right"));
> 60: jsp.setEnabled(true);
`jsp.setEnabled(true)` may not be required.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20214#discussion_r1680759493
PR Review Comment: https://git.openjdk.org/jdk/pull/20214#discussion_r1680765627
PR Review Comment: https://git.openjdk.org/jdk/pull/20214#discussion_r1680783117
More information about the client-libs-dev
mailing list