?
Solved

Repainting a JFrame automatically, continuously

Posted on 2011-09-26
3
Medium Priority
?
418 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 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