RFR: 5021949: JSplitPane setEnabled(false) shouldn't be partially functional [v3]

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon Jun 17 05:11:11 UTC 2024


On Fri, 14 Jun 2024 20:39:25 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Omit gtk
>
> src/java.desktop/share/classes/javax/swing/JSplitPane.java line 372:
> 
>> 370:     public void setEnabled(boolean enabled) {
>> 371:         super.setEnabled(enabled);
>> 372:         ((BasicSplitPaneUI)(this.getUI())).getDivider().setEnabled(enabled);
> 
> is it fine to assume that the UI is a BasicSplitPaneUI object? what happens if the JSplitPane UI is an AquaSplitPaneUI for example?

All L&F including Aqua extends BasicSplitPaneUI so it's ok...The existing test iterates through all L&F without any issue..

> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java line 369:
> 
>> 367:     @Override
>> 368:     public void setEnabled(boolean enabled) {
>> 369:         if (splitPane.isOneTouchExpandable() &&
> 
> i think for setEnabled the buttons should be enabled/disabled regardless of if splitPane isOneTouchExpandable is true so that the state is preserved even if setEnabled(false) is called before 
> setOneTouchExpandable(true)

No, the left and right arrow buttons are created ONLY when `isOneTouchExpandable` is true so it should be checked here too to enable/disable actions

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19695#discussion_r1642181720
PR Review Comment: https://git.openjdk.org/jdk/pull/19695#discussion_r1642179508


More information about the client-libs-dev mailing list