jQuery in Action, 3rd edition
The moose likes Applets and the fly likes Circular motion applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Circular motion applet" Watch "Circular motion applet" New topic

Circular motion applet

richard dela cruz

Joined: Oct 03, 2012
Posts: 1
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

Joined: Mar 10, 2008
Posts: 1932

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.

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Darryl Burke

Joined: May 03, 2008
Posts: 5048

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().

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link: http://aspose.com/file-tools
subject: Circular motion applet
It's not a secret anymore!