Solved

Repainting a JFrame automatically, continuously

Posted on 2011-09-26
3
401 Views
Last Modified: 2012-06-21
Hi

What might code look like, for a game, a thread, to repaint the game window constantly?
0
Comment
Question by:beavoid
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36707573
What you mean by constantly, just call repaint()  
maybe like that:

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


 
0
 

Author Comment

by:beavoid
ID: 36713564
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
 
LVL 47

Expert Comment

by:for_yan
ID: 36713579
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question