Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282772

JButton text set as HTML content has unwanted padding

    XMLWordPrintable

Details

    Description

       FULL PRODUCT VERSION :
      java version " 1.7.0_21 "
      Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin andr3i-mac.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Original config described in linked related issue. Currently still an issue in JDK 19 on macOS 11.6.1 Big Sur.

      A DESCRIPTION OF THE PROBLEM :
      Creating a JButton of size 37X37 with text set to HTML (such as an image of size 19X19), makes the image appear not centered and out of bounds of the button. This issue occurs with HTML images as well as HTML text.

      This is reproducible with Metal, Motif, and Nimbus LAFs.
      This is an older issue, but has been recently resolved for Aqua LAF only.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Create the JButton.
      2) Set the text to point to an HTML image
      3) Set the button's size to around 37X37 with image's size at 19X19

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The image centered within the JButton.
      ACTUAL -
      The image has some additional padding in front of it.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      No workaround.

      Attachments

        Issue Links

          Activity

            People

              dnguyen Damon Nguyen
              dnguyen Damon Nguyen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: