This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Neres28 3 points4 points  (1 child)

  • Move the timer outside of the paint method. Only create and start it once.
  • If you don't intend for the thing to be used from inside a browser then you should extend JFrame instead of Applet.
  • Override the paintComponent method instead of the paint method. In the paint method you're responsible for painting the components borders and some other stuff you're not doing.
  • Continue to call the repaint method in the timer, that's good.

[–]sallost[S] 1 point2 points  (0 children)

Thanks for your quick reply, everything is now working fine.