Issue addressed
In swing, you need an animator thread to run animation. So try make the class runnable and construct a thread.
public class Main extends JApplet implements Runnable {
Then in the run method, just call the [icode]loop()[/icode] method.
public void run()
{
loop();
}
Now the code in methods [icode]update()[/icode] and [icode]paint()[/icode] is incorrect. Change that to
@Override
public void update(Graphics g)
{
// Update should delegate to paint
paint(g);
}
@Override
public void paint(Graphics g)
{
// Just do painting here.
draw(font, 8, 8, 0, 0, 8, 8);
g.drawImage(img, 0, 0, APPLET_WIDTH * APPLET_SCALE, APPLET_HEIGHT * APPLET_SCALE, this);
}
This should work for you.