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

Alexey Ivanov aivanov at openjdk.org
Wed Jun 19 20:19:09 UTC 2024


On Mon, 17 Jun 2024 05:07:22 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> 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

Alisen's concern is valid.

What if `setEnabled(false)` is called when `isOneTouchExpandable` is `false` and then `setOneTouchExpandable(true)` is called which adds the buttons? The buttons are enabled when they should be disabled.

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

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


More information about the client-libs-dev mailing list