Solved

Repainting a JFrame automatically, continuously

Posted on 2011-09-26
3
378 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 62
Updating Java 9 87
pairstar challenge 2 42
word0 challenge 4 54
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 first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now