Repainting a JFrame automatically, continuously

Hi

What might code look like, for a game, a thread, to repaint the game window constantly?
beavoidAsked:
Who is Participating?
 
for_yanConnect With a Mentor Commented:
What you mean by constantly, just call repaint()  
maybe like that:

Thread.currentThread().sleep(1000);
repaint();


 
0
 
beavoidAuthor Commented:
That seems to work nicely!
Thanks
But, I do 10 mili-seconds, not 1000!

I worry about there being congestion, but does the multi-threading eliminate that as a concern?
0
 
for_yanCommented:
I'm not sure multithreading will help with that.

Try first to do it without any special things. Myabe you want to consider incesing time - I odn't know how long it takes to redraw
but it seeems to nme it may be longer than 10 ms
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.