revert: no background progress is visible

This commit is contained in:
anna
2010-05-06 21:01:24 +04:00
parent 2293b5a5a7
commit 5a8cf4a5c4
@@ -150,16 +150,33 @@ public abstract class AnimatedIcon extends JComponent implements Disposable {
protected void paintComponent(Graphics g) {
if (myPaintingBgNow) return;
if (isOpaque()) {
final Container parent = getParent();
JComponent opaque = null;
if (parent instanceof JComponent) {
opaque = (JComponent)UIUtil.findNearestOpaque((JComponent)parent);
if ((myAnimator.isRunning() || myPaintPassive || (myLastPaintWasRunning && !myAnimator.isRunning()))) {
Rectangle b = getBounds();
if (!isOpaque()) {
try {
myPaintingBgNow = true;
Container p = getParent();
if (p instanceof JComponent) {
JComponent parentComponent = (JComponent)p;
RepaintManager.currentManager(p).addDirtyRegion(parentComponent, b.x, b.y, b.width, b.height);
}
}
finally {
myPaintingBgNow = false;
}
} else {
Container parent = getParent();
if (parent instanceof JComponent) {
final Component opaque = UIUtil.findNearestOpaque((JComponent)parent);
if (opaque != null) {
g.setColor(opaque.getBackground());
g.fillRect(b.x, b.y, b.width, b.height);
}
}
}
Color bg = opaque != null ? opaque.getBackground() : UIManager.getColor("Panel.background");
g.setColor(bg);
g.fillRect(0, 0, getWidth(), getHeight());
}
}
Icon icon;
@@ -190,9 +207,4 @@ public abstract class AnimatedIcon extends JComponent implements Disposable {
public boolean isAnimated() {
return true;
}
@Override
public String toString() {
return myName + " isRunning=" + myRunning + " isOpaque=" + isOpaque() + " paintPassive=" + myPaintPassive;
}
}