< prev index next >
src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
Print this page
*** 47,56 ****
--- 47,58 ----
private int progressPadding;
private boolean rotateText; // added for Nimbus LAF
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
/**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
*** 112,121 ****
--- 114,125 ----
tileWidth *= 0.857;
} else if ("mini".equals(scaleKey)){
tileWidth *= 0.784;
}
}
+ minBarSize = (Dimension)style.get(context, "ProgressBar.minBarSize");
+ glowWidth = style.getInt(context, "ProgressBar.glowWidth", 0);
context.dispose();
}
/**
* {@inheritDoc}
*** 256,266 ****
- (pBarInsets.top + progressPadding
+ pBarInsets.bottom + progressPadding);
if (!SynthLookAndFeel.isLeftToRight(pBar)) {
x = pBar.getWidth() - pBarInsets.right - width
! - progressPadding;
}
} else { // JProgressBar.VERTICAL
x = pBarInsets.left + progressPadding;
width = pBar.getWidth()
- (pBarInsets.left + progressPadding
--- 260,270 ----
- (pBarInsets.top + progressPadding
+ pBarInsets.bottom + progressPadding);
if (!SynthLookAndFeel.isLeftToRight(pBar)) {
x = pBar.getWidth() - pBarInsets.right - width
! - progressPadding - glowWidth;
}
} else { // JProgressBar.VERTICAL
x = pBarInsets.left + progressPadding;
width = pBar.getWidth()
- (pBarInsets.left + progressPadding
*** 269,281 ****
- (pBarInsets.top + progressPadding
+ pBarInsets.bottom + progressPadding)));
y = pBar.getHeight() - pBarInsets.bottom - height
- progressPadding;
! // When the progress bar is vertical we always paint
! // from bottom to top, not matter what the component
! // orientation is.
}
}
} else {
boxRect = getBox(boxRect);
x = boxRect.x + progressPadding;
--- 273,285 ----
- (pBarInsets.top + progressPadding
+ pBarInsets.bottom + progressPadding)));
y = pBar.getHeight() - pBarInsets.bottom - height
- progressPadding;
! if (SynthLookAndFeel.isLeftToRight(pBar)) {
! y -= glowWidth;
! }
}
}
} else {
boxRect = getBox(boxRect);
x = boxRect.x + progressPadding;
*** 305,317 ****
--- 309,324 ----
context, g, x, i, width, tileWidth, pBar.getOrientation());
}
}
g.setClip(clip);
} else {
+ if (minBarSize == null || (width >= minBarSize.width
+ && height >= minBarSize.height)) {
context.getPainter().paintProgressBarForeground(context, g,
x, y, width, height, pBar.getOrientation());
}
+ }
if (pBar.isStringPainted()) {
paintText(context, g, pBar.getString());
}
}
< prev index next >