[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Repainting a JFrame automatically, continuously

Posted on 2011-09-26
3
Medium Priority
?
420 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Suggested Courses

649 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