< prev index next >
src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
Print this page
*** 49,58 ****
--- 49,59 ----
private boolean paintOutsideClip;
private boolean tileWhenIndeterminate; //whether to tile indeterminate painting
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.
*
* @param x component to create UI object for
*** 84,93 ****
--- 85,95 ----
* {@inheritDoc}
*/
@Override
protected void installDefaults() {
updateStyle(progressBar);
+ textUIDrawing = SwingUtilities2.getTextUIDrawing(textUIDrawing);
}
private void updateStyle(JProgressBar c) {
SynthContext context = getContext(c, ENABLED);
SynthStyle oldStyle = style;
*** 129,138 ****
--- 131,144 ----
SynthContext context = getContext(progressBar, ENABLED);
style.uninstallDefaults(context);
context.dispose();
style = null;
+ if (textUIDrawing != SwingUtilities2.DEFAULT_UI_TEXT_DRAWING
+ && textUIDrawing instanceof UIResource) {
+ textUIDrawing = SwingUtilities2.DEFAULT_UI_TEXT_DRAWING;
+ }
}
/**
* {@inheritDoc}
*/
*** 430,440 ****
if (stringHeight > size.height) {
size.height = stringHeight;
}
// adjust the width if necessary to make room for the string
! int stringWidth = SwingUtilities2.stringWidth(
progressBar, fontSizer, progString);
if (stringWidth > size.width) {
size.width = stringWidth;
}
}
--- 436,446 ----
if (stringHeight > size.height) {
size.height = stringHeight;
}
// adjust the width if necessary to make room for the string
! int stringWidth = textUIDrawing.getStringWidth(
progressBar, fontSizer, progString);
if (stringWidth > size.width) {
size.width = stringWidth;
}
}
*** 445,455 ****
if (stringHeight > size.width) {
size.width = stringHeight;
}
// make sure the height is big enough for the string
! int stringWidth = SwingUtilities2.stringWidth(
progressBar, fontSizer, progString);
if (stringWidth > size.height) {
size.height = stringWidth;
}
}
--- 451,461 ----
if (stringHeight > size.width) {
size.width = stringHeight;
}
// make sure the height is big enough for the string
! int stringWidth = textUIDrawing.getStringWidth(
progressBar, fontSizer, progString);
if (stringWidth > size.height) {
size.height = stringWidth;
}
}
< prev index next >