--- old/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java 2016-04-06 23:43:20.000000000 +0400 +++ new/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java 2016-04-06 23:43:19.000000000 +0400 @@ -69,6 +69,7 @@ private Rectangle paintIconR = new Rectangle(); private Rectangle paintTextR = new Rectangle(); + private TextUIDrawing textUIDrawing; static void loadActionMap(LazyActionMap map) { map.put(new Actions(Actions.PRESS)); @@ -129,7 +130,7 @@ { int mnemIndex = l.getDisplayedMnemonicIndex(); g.setColor(l.getForeground()); - SwingUtilities2.drawStringUnderlineCharAt(l, g, s, mnemIndex, + textUIDrawing.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY); } @@ -151,10 +152,10 @@ int accChar = l.getDisplayedMnemonicIndex(); Color background = l.getBackground(); g.setColor(background.brighter()); - SwingUtilities2.drawStringUnderlineCharAt(l, g, s, accChar, + textUIDrawing.drawStringUnderlineCharAt(l, g, s, accChar, textX + 1, textY + 1); g.setColor(background.darker()); - SwingUtilities2.drawStringUnderlineCharAt(l, g, s, accChar, + textUIDrawing.drawStringUnderlineCharAt(l, g, s, accChar, textX, textY); } @@ -361,6 +362,7 @@ protected void installDefaults(JLabel c){ LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", "Label.font"); LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); + textUIDrawing = SwingUtilities2.getTextUIDrawing(textUIDrawing); } /** @@ -418,6 +420,10 @@ * @param c an instance of {@code JLabel} */ protected void uninstallDefaults(JLabel c){ + if (textUIDrawing != SwingUtilities2.DEFAULT_UI_TEXT_DRAWING + && textUIDrawing instanceof UIResource) { + textUIDrawing = SwingUtilities2.DEFAULT_UI_TEXT_DRAWING; + } } /**