< prev index next >

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

Print this page

        

*** 1088,1098 **** 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); 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. --- 1088,1099 ---- 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.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,1116 **** textR.width -= lsb; } if (textR.width > availTextWidth) { text = SwingUtilities2.clipString(c, fm, text, availTextWidth); ! textR.width = SwingUtilities2.stringWidth(c, fm, text); } textR.height = fm.getHeight(); } } --- 1107,1118 ---- textR.width -= lsb; } if (textR.width > availTextWidth) { text = SwingUtilities2.clipString(c, fm, text, availTextWidth); ! textR.width = SwingUtilities2.getTextUIDrawing(c) ! .getStringWidth(c, fm, text); } textR.height = fm.getHeight(); } }
< prev index next >