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

Alexey Ivanov aivanov at openjdk.org
Wed Jun 26 09:29:13 UTC 2024


On Wed, 26 Jun 2024 08:43:40 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> 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.
>
> Right now, the buttons are always enabled and rendered when isOneTouchExpandable is enabled without any scope to disable...We need this code anyway to set/reset buttons state..I guess on top of this code, we can add isEnabled if it is needed but for this issue, isEnabled is not needed..

This approach will automatically resolve [the scenario above](https://github.com/openjdk/jdk/pull/19695/files#r1646653721) where buttons may have inconsistent state.

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

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


More information about the client-libs-dev mailing list