Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fps is slowing down

 
Jochem Gruter
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rob Spoor
Sheriff
Pie
Posts: 20665
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, Thread.sleep(17) will sleep 17 milliseconds, not 17 seconds.
 
Stephan van Hulst
Bartender
Posts: 6322
78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic