RFR: 5021949: JSplitPane setEnabled(false) shouldn't be partially functional [v3]
Alexey Ivanov
aivanov at openjdk.org
Tue Jun 18 12:25:21 UTC 2024
On Fri, 14 Jun 2024 09:28:28 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> Issue is seen in that if we call setEnabled(false) over JSplitPane than it can't be dragged via its divider, But if SplitPane have one touch expandable true than user can click those buttons and change the divider position.
>> So, if splitpane is disabled, then both dragging in divider and one-touch-expandable click should be disabled.
>> Fix is made to override setEnabled and disable one-touch-expandable buttons actions..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Omit gtk
Changes requested by aivanov (Reviewer).
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java line 376:
> 374: leftButton.setEnabled(enabled);
> 375: }
> 376: }
Is it possible to override `isEnabled` in `rightButton` and `leftButton` so that it returns the state of `JSplitPane`?
Alternatively, the buttons could install a `PropertyChangeListener` for `"enabled"` property and align their state to the host split pane.
test/jdk/javax/swing/JSplitPane/TestSplitPaneEnableTest.java line 100:
> 98: robot.mouseMove(loc.x, loc.y);
> 99: robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
> 100: robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
Isn't it enough to verify the state of the buttons whether they're enabled or not. It should be simpler, it could be done without rendering the frame.
test/jdk/javax/swing/JSplitPane/TestSplitPaneEnableTest.java line 147:
> 145: rightOneTouchButton = super.createRightOneTouchButton();
> 146: return rightOneTouchButton;
> 147: }
Alternatively, you could add methods which return `leftButton` and `rightButton` fields.
-------------
PR Review: https://git.openjdk.org/jdk/pull/19695#pullrequestreview-2125353120
PR Review Comment: https://git.openjdk.org/jdk/pull/19695#discussion_r1644368671
PR Review Comment: https://git.openjdk.org/jdk/pull/19695#discussion_r1644371184
PR Review Comment: https://git.openjdk.org/jdk/pull/19695#discussion_r1644374062
More information about the client-libs-dev
mailing list