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

Phil Race prr at openjdk.org
Fri Jul 22 20:21:05 UTC 2022


On Wed, 20 Jul 2022 09:12:38 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.

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

> 425:             = "The size of the divider.")
> 426:     public void setDividerSize(int newSize) {
> 427:         if (newSize < 0) {

What are the "unexpected results" of < 0 ?
Should it perhaps be 1 ? 
And what about this ?
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/plaf/basic/BasicSplitPaneDivider.html#setDividerSize(int)

And we need a CSR ...

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

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



More information about the client-libs-dev mailing list