mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure valid icon index
This commit is contained in:
@@ -63,7 +63,15 @@ public abstract class AnimatedIcon extends JComponent implements Disposable {
|
||||
|
||||
myAnimator = new Animator(myName, icons.length, cycleLength, true) {
|
||||
public void paintNow(final float frame, final float totalFrames, final float cycle) {
|
||||
myCurrentIconIndex = (int)frame;
|
||||
if (frame < 0) {
|
||||
myCurrentIconIndex = 0;
|
||||
}
|
||||
else if (frame >= myIcons.length) {
|
||||
myCurrentIconIndex = myIcons.length-1;
|
||||
}
|
||||
else {
|
||||
myCurrentIconIndex = (int)frame;
|
||||
}
|
||||
paintImmediately(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user