--- old/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonUI.java 2016-04-06 23:43:18.000000000 +0400 +++ new/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonUI.java 2016-04-06 23:43:18.000000000 +0400 @@ -38,6 +38,7 @@ import javax.swing.plaf.ButtonUI; import javax.swing.plaf.UIResource; import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.TextUIDrawing; import javax.swing.text.View; /** @@ -64,6 +65,8 @@ */ protected int defaultTextShiftOffset; + private TextUIDrawing textUIDrawing; + private static final String propertyPrefix = "Button" + "."; private static final Object BASIC_BUTTON_UI_KEY = new Object(); @@ -140,6 +143,7 @@ } LookAndFeel.installProperty(b, "iconTextGap", Integer.valueOf(4)); + textUIDrawing = SwingUtilities2.getTextUIDrawing(textUIDrawing); } /** @@ -217,6 +221,10 @@ */ protected void uninstallDefaults(AbstractButton b) { LookAndFeel.uninstallBorder(b); + if (textUIDrawing != SwingUtilities2.DEFAULT_UI_TEXT_DRAWING + && textUIDrawing instanceof UIResource) { + textUIDrawing = SwingUtilities2.DEFAULT_UI_TEXT_DRAWING; + } } // ******************************** @@ -381,17 +389,17 @@ if(model.isEnabled()) { /*** paint the text normally */ g.setColor(b.getForeground()); - SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex, + textUIDrawing.drawStringUnderlineCharAt(c, g,text, mnemonicIndex, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset()); } else { /*** paint the text disabled ***/ g.setColor(b.getBackground().brighter()); - SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex, + textUIDrawing.drawStringUnderlineCharAt(c, g,text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); g.setColor(b.getBackground().darker()); - SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex, + textUIDrawing.drawStringUnderlineCharAt(c, g,text, mnemonicIndex, textRect.x - 1, textRect.y + fm.getAscent() - 1); } }