< prev index next >

src/java.desktop/share/classes/javax/swing/SwingUtilities.java

Print this page

        

@@ -1088,11 +1088,12 @@
             if (v != null) {
                 textR.width = Math.min(availTextWidth,
                                        (int) v.getPreferredSpan(View.X_AXIS));
                 textR.height = (int) v.getPreferredSpan(View.Y_AXIS);
             } else {
-                textR.width = SwingUtilities2.stringWidth(c, fm, text);
+                textR.width = SwingUtilities2.getTextUIDrawing(c)
+                        .getStringWidth(c, fm, text);
                 lsb = SwingUtilities2.getLeftSideBearing(c, fm, text);
                 if (lsb < 0) {
                     // If lsb is negative, add it to the width and later
                     // adjust the x location. This gives more space than is
                     // actually needed.

@@ -1106,11 +1107,12 @@
                     textR.width -= lsb;
                 }
                 if (textR.width > availTextWidth) {
                     text = SwingUtilities2.clipString(c, fm, text,
                                                       availTextWidth);
-                    textR.width = SwingUtilities2.stringWidth(c, fm, text);
+                    textR.width = SwingUtilities2.getTextUIDrawing(c)
+                            .getStringWidth(c, fm, text);
                 }
                 textR.height = fm.getHeight();
             }
         }
 
< prev index next >