On Thu, 28 Jul 2022 04:07:55 GMT, Prasanta Sadhukhan <[email protected]> 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: > > Remove implNote tag All look and feels initially set the divider size to what they need. This is done here: https://github.com/openjdk/jdk/blob/eab4c0c49934bd6f37a0b6174ca10e5c8708d13b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java#L357-L358 Each L&F uses its own divider size. E.g. Windows L&F uses `5`: https://github.com/openjdk/jdk/blob/0a65e8b282fd41e57108422fbd140527d9697efd/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java#L1247 Or Metal L&F uses `10`: https://github.com/openjdk/jdk/blob/d4b040f42dd0a9100ad1ffa55de4ae4f20e9f182/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java#L1371 So a L&F could also use divider size zero to implement an invisible divider. Don't see a reason, why divider size zero should be no longer allowed... > I didn't get why some effect like the "visibility" of the divider in some L&F > should be allowed to over-rule the specified size. If the application invokes `JSplitPane.setDividerSize(int)`, then this overrules the divider size specified by the L&F. There is a field `JSplitPane.dividerSizeSet` that is used for this. L&Fs do not invoke `JSplitPane.setDividerSize(int)` directly. Instead they invoke `LookAndFeel.installProperty(...)`, which calls `JSplitPane.setUIProperty(...)`, which checks flag `dividerSizeSet` and does not change divider size if the application has invoked `setDividerSize(...)`: https://github.com/openjdk/jdk/blob/096bca4a9c5e8ac2668dd965df92153ea1d80add/src/java.desktop/share/classes/javax/swing/JSplitPane.java#L1059-L1064 ------------- PR: https://git.openjdk.org/jdk/pull/9566
