RFR: 8318590: JButton ignores margin when painting HTML text
Phil Race
prr at openjdk.org
Wed Nov 29 19:11:06 UTC 2023
On Tue, 28 Nov 2023 23:40:45 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:
> The initial issue was a padding issue for JButton when HTML content was set as the button's text. [JDK-8282772](https://bugs.openjdk.org/browse/JDK-8282772), [JDK-8015854](https://bugs.openjdk.org/browse/JDK-8015854), and [JDK-8302173](https://bugs.openjdk.org/browse/JDK-8302173) are the issues related to the fix. The initial bug report was for Metal L&F, since it has a drastically different button margin from the rest (2, 14, 2, 14). This left and right margin of 14px led to the initial bug report. However, it was determined that the issue was not an issue, and instead, a problem with the reporter's implementation since they weren't aware of the difference in Metal's button margins versus other L&Fs.
>
> This PR reverts these changes since it was determined in [this PR](https://github.com/JFormDesigner/FlatLaf/issues/746) that the fix causes a new issue regarding JButton contents' positioning. In addition, a new line is added to BasicLookAndFeel (since Metal derives its default button margin here) to better document the difference in button margins compared to other L&Fs.
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java line 464:
> 462: * <p>
> 463: * The default button margin value is (2, 14, 2, 14), which may
> 464: * greatly differ from other LookAndFeel defaults.
This will need a CSR, which is fine.
But
(1) Basic is an abstract L&F .. it can't be the place to say what Metal does since most L&Fs derive from Basic
And something about a JButton ought to be closer to ButtonUI or JButton.
(2) Do we have precedent for calling out the exact number of (user space) pixels ?
I'd prefer some more waffly wording like
"The default margins may vary greatly depending on the L&F".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16869#discussion_r1409750661
More information about the client-libs-dev
mailing list