| Author |
fps is slowing down
|
Jochem Gruter
Greenhorn
Joined: Aug 16, 2011
Posts: 9
|
|
My fps is slowing down. I begin at 60 fps and after 5 minutes it is 30 and after 15 minutes it is 5 fps.
My paint is in a jPanel and I've just painted some text and rects.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4163
|
|
Use a Swing Timer, not Thread#sleep(...) for animation. And never never run an infinite loop or sleep on the EDT.
References:
http://download.oracle.com/javase/tutorial/uiswing/misc/timer.html
http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html
|
luck, db
There are no new questions, but there may be new answers.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19214
|
|
|
Also, Thread.sleep(17) will sleep 17 milliseconds, not 17 seconds.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Stephan van Hulst
Bartender
Joined: Sep 20, 2010
Posts: 3044
|
|
*scratches head*
It's not necessarily on the EDT right? And 17 ms seems like a decent amount to get around 60fps.
Anyway, I don't see why the OP is messing with thread priorities.
|
 |
 |
|
|
subject: fps is slowing down
|
|
|