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

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Jun 26 08:39:10 UTC 2024


On Tue, 18 Jun 2024 12:13:49 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> All L&F including Aqua extends BasicSplitPaneUI so it's ok...The existing test iterates through all L&F without any issue..
>
>> All L&F including Aqua extends BasicSplitPaneUI so it's ok...The existing test iterates through all L&F without any issue..
> 
> That is true, yet it is still possible to set a L&F that doesn't extend `BasicSplitPaneUI` and the updated code will throw `ClassCastException`.
> 
> I'm sure such a situation is rare, if it exists at all, yet I don't think the public API should have such a limitation: `JSplitPane.setUI` accepts `SplitPaneUI`, so it is valid to pass an object that is not subclass of `BasicSplitPaneUI`.

ok...Will add check..

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

Why buttons will be enabled? The buttons state is determined by `setEnabled `param, if `setEnabled `is false, then irrespective of `isOneTouchExpandable`, it will be disabled...`isOneTouchExpandable `is just extra layer of check as that determines whether arrow buttons are rendered or not....If oneTouchExpandable is not there then arrow buttons itself is not created so no point set their state...

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

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


More information about the client-libs-dev mailing list