19 package org.sleuthkit.autopsy.discovery.ui;
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import javax.swing.Timer;
33 final class SwingAnimator {
36 private final SwingAnimatorCallback callback;
39 private Timer timer = null;
42 private static final int INITIAL_TIMING = 30;
43 private int timing = INITIAL_TIMING;
52 SwingAnimator(SwingAnimatorCallback callback) {
53 this(callback, INITIAL_TIMING);
64 SwingAnimator(SwingAnimatorCallback callback,
int frameTiming) {
65 this.callback = callback;
80 return timer.isRunning();
100 if (timer != null && timer.isRunning()) {
103 timer =
new Timer(timing,
new CallbackListener());
116 if (callback.hasTerminated()) {
118 throw new IllegalStateException(
"Callback listener should not be fired outside of SwingAnimator timer control");
122 callback.callback(SwingAnimator.this);
void actionPerformed(ActionEvent e)