--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java 2016-04-06 23:43:29.000000000 +0400 +++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java 2016-04-06 23:43:29.000000000 +0400 @@ -51,6 +51,7 @@ private int tileWidth; //the width of each tile private Dimension minBarSize; // minimal visible bar size private int glowWidth; // Glow around the bar foreground + private TextUIDrawing textUIDrawing; /** * Creates a new UI object for the given component. @@ -86,6 +87,7 @@ @Override protected void installDefaults() { updateStyle(progressBar); + textUIDrawing = SwingUtilities2.getTextUIDrawing(textUIDrawing); } private void updateStyle(JProgressBar c) { @@ -131,6 +133,10 @@ style.uninstallDefaults(context); context.dispose(); style = null; + if (textUIDrawing != SwingUtilities2.DEFAULT_UI_TEXT_DRAWING + && textUIDrawing instanceof UIResource) { + textUIDrawing = SwingUtilities2.DEFAULT_UI_TEXT_DRAWING; + } } /** @@ -432,7 +438,7 @@ } // adjust the width if necessary to make room for the string - int stringWidth = SwingUtilities2.stringWidth( + int stringWidth = textUIDrawing.getStringWidth( progressBar, fontSizer, progString); if (stringWidth > size.width) { size.width = stringWidth; @@ -447,7 +453,7 @@ } // make sure the height is big enough for the string - int stringWidth = SwingUtilities2.stringWidth( + int stringWidth = textUIDrawing.getStringWidth( progressBar, fontSizer, progString); if (stringWidth > size.height) { size.height = stringWidth;