En este ejemplo se va a ver como se crea una animación simple usando hilos y reescribiendo el metodo paint

import java.applet.Applet;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class Animacion extends Applet implements Runnable {
int delay = 100;
int fn = -1;

Thread hilo;

boolean frozen = false;

public void init() {
String str;
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (frozen) {
frozen = false;
start();
} else {
frozen = true;
stop();
}
}
});
}

public void start() {
if (!frozen) {
if (hilo == null) {
hilo = new Thread(this);
}
hilo.start();
}
}

public void stop() {
hilo = null;
}

public void run() {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);

long startTime = System.currentTimeMillis();

Thread currentThread = Thread.currentThread();

while (currentThread == hilo) {
fn++;

repaint();

try {
startTime += delay;
Thread.sleep(100);
} catch (InterruptedException e) {
break;
}
}
}

public void paint(Graphics g) {
g.drawString(“Frame ” + fn, 0, 30);
}
}