Revert "revert: no background progress is visible"

This reverts commit 5a8cf4a5c4.
This commit is contained in:
Kirill Kalishev
2010-05-11 13:21:32 +04:00
parent 610919ba6c
commit bd36aa4f8d
@@ -150,33 +150,16 @@ public abstract class AnimatedIcon extends JComponent implements Disposable {
protected void paintComponent(Graphics g) {
if (myPaintingBgNow) return;
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);
}
}
if (isOpaque()) {
final Container parent = getParent();
JComponent opaque = null;
if (parent instanceof JComponent) {
opaque = (JComponent)UIUtil.findNearestOpaque((JComponent)parent);
}
}
Color bg = opaque != null ? opaque.getBackground() : UIManager.getColor("Panel.background");
g.setColor(bg);
g.fillRect(0, 0, getWidth(), getHeight());
}
Icon icon;
@@ -207,4 +190,9 @@ 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;
}
}