File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fps is slowing down

 
Jochem Gruter
Greenhorn
Posts: 9
  • 0
  • 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: 5115
11
Java Netbeans IDE Opera
  • 0
  • 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: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • 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
Pie
Posts: 4828
34
Chrome Netbeans IDE Windows
  • 0
  • 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