RFR: 8015854: [macosx] JButton's HTML ImageView adding unwanted padding [v8]

DamonGuy duke at openjdk.java.net
Tue Mar 1 23:37:12 UTC 2022


On Tue, 1 Mar 2022 23:27:57 GMT, DamonGuy <duke at openjdk.java.net> wrote:

>> Html does not fit in JButton at certain sizes because default Insets cause html to be displayed off-center. 
>> 
>> Changes made to SwingUtilities.java layoutCompoundLabelImpl method to enable clipping if html does not fit, similar to regular text. AquaButtonUI.java now detects when html does not fit, and an implementation for alternate insets that are recursively tested for regular text inside layoutAndGetText() are now also being used for html content.
>> 
>> Created test (Bug8015854.java) with the same format as the test described on the issue. The button is of size 37x37 with an image of a red square sized 19x19. The test checks for red pixels on the edges of where the square image should be from the center of the button. The test fails with the non-changed jdk, but passes with the changes.
>
> DamonGuy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Updated test to be headless using BufferedImage.

I have updated the test to be headless by using BufferedImage. 

There is no new bug submitted yet for other LAFs that I know of. I tested other LAFs and the issue does persist, so I can submit the bug for them if necessary. The other LAFs I tested were Metal, Nimbus, and Motif.

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

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



More information about the client-libs-dev mailing list