On Wed, 26 Jun 2024 08:36:45 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

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

Consider the following scenario:


JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                new JButton("Left"),
                                new JButton("Right"));

jsp.setOneTouchExpandable(false);
jsp.setEnabled(false);
// At this point neither `leftButton` or `rightButton` are created

jsp.setOneTouchExpandable(true);
// This has created both `leftButton` or `rightButton`,
// and both buttons are enabled, aren't they?
// I can't see how either button could get disabled.

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

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

Reply via email to