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

DamonGuy duke at openjdk.java.net
Fri Mar 4 19:30:13 UTC 2022


On Tue, 1 Feb 2022 16:11:52 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.

This pull request has now been integrated.

Changeset: 9c817d38
Author:    Damon Nguyen <damon.nguyen at oracle.com>
Committer: Alexey Ivanov <aivanov at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/9c817d38806708f84139e3180ac86a3805dcce5f
Stats:     125 lines in 2 files changed: 123 ins; 1 del; 1 mod

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

Reviewed-by: psadhukhan, aivanov

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

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



More information about the client-libs-dev mailing list