|
|
@ -138,8 +138,17 @@ public abstract class Animator { |
|
|
|
this.enabled = enabled; |
|
|
|
this.enabled = enabled; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void stopAnimation() { |
|
|
|
|
|
|
|
currentFrame = totalFrames - 1; |
|
|
|
|
|
|
|
paint(); |
|
|
|
|
|
|
|
animationDone(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void resume(final int startFrame, final JComponent target) { |
|
|
|
public void resume(final int startFrame, final JComponent target) { |
|
|
|
if (!target.isVisible() || !target.isShowing()) return; |
|
|
|
if (!target.isVisible() || !target.isShowing()) { |
|
|
|
|
|
|
|
stopAnimation(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
resume(startFrame); |
|
|
|
resume(startFrame); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -148,9 +157,7 @@ public abstract class Animator { |
|
|
|
throw new IllegalArgumentException("Starting frame must be non negative."); |
|
|
|
throw new IllegalArgumentException("Starting frame must be non negative."); |
|
|
|
} |
|
|
|
} |
|
|
|
if (cycleDuration == 0 || startFrame >= totalFrames || !animationsEnabled()) { |
|
|
|
if (cycleDuration == 0 || startFrame >= totalFrames || !animationsEnabled()) { |
|
|
|
currentFrame = totalFrames - 1; |
|
|
|
stopAnimation(); |
|
|
|
paint(); |
|
|
|
|
|
|
|
animationDone(); |
|
|
|
|
|
|
|
} else if (ticker == null) { |
|
|
|
} else if (ticker == null) { |
|
|
|
this.startFrame = startFrame; |
|
|
|
this.startFrame = startFrame; |
|
|
|
ticker = scheduler.scheduleWithFixedDelay(new Runnable() { |
|
|
|
ticker = scheduler.scheduleWithFixedDelay(new Runnable() { |
|
|
|