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

Additional information to JDK-8226215

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      I was able to resolve the issue by changing `BasicToggleButtonUI` to use `SwingUtilities2.getFontMetrics(c, g)` instead of `g.getFontMetrics()`. See source code for the patch.


      ---------- BEGIN SOURCE ----------
      diff -r 175eb80c253a src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java
      --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Wed Apr 03 02:25:37 2019 +0100
      +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Wed Jun 12 14:12:22 2019 -0400
      @@ -25,6 +25,7 @@
       
       package javax.swing.plaf.basic;
       
      +import sun.swing.SwingUtilities2;
       import sun.awt.AppContext;
       
       import java.awt.*;
      @@ -82,7 +83,7 @@
               ButtonModel model = b.getModel();
       
               Dimension size = b.getSize();
      - FontMetrics fm = g.getFontMetrics();
      + FontMetrics fm = SwingUtilities2.getFontMetrics(c, g);
       
               Insets i = c.getInsets();

      ---------- END SOURCE ----------

      FREQUENCY : always


            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: