RFR: 4797982: Setting negative size of JSplitPane divider leads to unexpected results. [v4]

Phil Race prr at openjdk.org
Tue Jul 26 21:53:00 UTC 2022


On Tue, 26 Jul 2022 04:55:44 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Setting JSplitPane divider size to negative value leads to unexpected results and is not desirable and seems to be not practical.
>> I guess we should return IAE but it might break existing app so fixed to clamp it to 0 incase negative value is tried to be set for divider size.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix

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

> 421:      * @implNote Divider sizes < 1 are ignored.
> 422:      *           {@code SplitPane.dividerSize} L&F specific value
> 423:      *           will instead be used.

This isn't the same as ignoring it. Suppose we do
setDividerSize(5);
setDividerSize(-1);

what is the value after both of these - per your ignoring code 5, but per your doc it will be whatever the default was before you started to change it.

I think it sufficient to say it will be ignored and drop the 2nd clause.

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

PR: https://git.openjdk.org/jdk/pull/9566



More information about the client-libs-dev mailing list