On Wed, 26 Jun 2024 09:00:28 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> Issue is seen in that if we call setEnabled(false) over JSplitPane than it 
>> can't be dragged via its divider, But if SplitPane have one touch expandable 
>> true than user can click those buttons and change the divider position. 
>> So, if splitpane is disabled, then both dragging in divider and 
>> one-touch-expandable click should be disabled.
>> Fix is made to override setEnabled and disable one-touch-expandable buttons 
>> actions..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Test update

Changes requested by aivanov (Reviewer).

src/java.desktop/share/classes/javax/swing/JSplitPane.java line 1:

> 1: /*

Copyright year to be updated in `JSplitPane`.

test/jdk/javax/swing/JSplitPane/TestSplitPaneEnableTest.java line 82:

> 80:                     jsp.setOneTouchExpandable(true);
> 81: 
> 82:                     jsp.setEnabled(false);

> It should be simpler, it could be done without rendering the frame.

I'm pretty sure it could be done *without creating a frame* and without showing 
the frame:

Suggestion:

                    jsp.setUI(new TestSplitPaneUI());
                    jsp.setOneTouchExpandable(true);

                    jsp.setEnabled(false);
                    
                    if (leftOneTouchButton.isEnabled()) {
                        throw new RuntimeException("leftButton is enabled for 
disabled JSplitPane");
                    }
                    if (rightOneTouchButton.isEnabled()) {
                        throw new RuntimeException("rightButton is enabled for 
disabled JSplitPane");
                    }


Calling `jsp.setEnabled(false);` changes the state of the buttons immediately, 
doesn't it?

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

PR Review: https://git.openjdk.org/jdk/pull/19695#pullrequestreview-2141208110
PR Review Comment: https://git.openjdk.org/jdk/pull/19695#discussion_r1654454389
PR Review Comment: https://git.openjdk.org/jdk/pull/19695#discussion_r1654450514

Reply via email to