RFR: JDK-8282772: JButton text set as HTML content has unwanted padding [v2]

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Mon May 9 06:08:49 UTC 2022


On Wed, 27 Apr 2022 18:52:46 GMT, DamonGuy <duke at openjdk.java.net> wrote:

>> The insets for buttons were incorrect for L&Fs except for Aqua when the text is set to HTML. This was fixed in Aqua by adding a conditional to check for the BasicHTML property key in the button component. This same logic can be used to fix Metal & Motif L&Fs in BasicButtonUI, but Nimbus is not fixed by this. Nimbus gets its default values from a skin.laf file, and when the defaults here are set to have left & right insets to 0 for ButtonUI, the issue is fixed. I also tested for non-HTML text after the changes, and the changes do not affect normal text.
>> 
>> The HtmlButtonImageTest has been changed to cycle through all L&Fs available on a device.
>
> DamonGuy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Changed approach to fix.

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java line 394:

> 392:         Insets insets = SynthLookAndFeel.getPaintingInsets(ss, paintInsets);
> 393: 
> 394:         final View v = (View)c.getClientProperty(BasicHTML.propertyKey);

I guess this issue is only for JButton so is it needed to apply this for all components or we need to put a check for `c instance of JButton`

test/jdk/javax/swing/JButton/HtmlButtonImageTest/HtmlButtonImageTest.java line 29:

> 27:  * @summary Tests HTML image as JButton text for unwanted padding on macOS Aqua LAF
> 28:  * @run main HtmlButtonImageTest
> 29:  */

I believe you have run this test on CI systems on all platforms

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

PR: https://git.openjdk.java.net/jdk/pull/8407



More information about the client-libs-dev mailing list