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

Circular motion applet

 
richard dela cruz
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone tell me an easy way to make a single dot move in circular motion? so far... i've only done these...
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about how you would normally find the X and Y coördinates of a point on the unit circle.
Then think about how you could use that same logic to implement a dot that moves in a circular motion.
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use Thread#sleep(...) in a painting method override or indeed in any code that runs on the EDT.

Use a javax.swing.Timer for animation. Change the coordinates and call repaint().
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic