This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Information about moving shapes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Information about moving shapes" Watch "Information about moving shapes" New topic

Information about moving shapes

Hugh Thompson

Joined: Apr 18, 2010
Posts: 1


I have a project in which I feel it would be useful to have some form of animation. Not something too complicated, but a stick figure maybe made up of lines and a circle . I have data that I will be reading from files, and was hoping to be able to use this data to make the stick figure "move" in some simple way.

I've been looking and trying code related to shapes, and I know it is possible to specify the coordinates of a shape. But what if I want that shape to move in real time? So while I am reading coordinate data from a file, for example, a circle in my interface will move based on the information in the file. The user will see the circle moving while the code is running. Is this feasible at all?? How could it be implemented?

Many thanks,
Rob Spoor

Joined: Oct 27, 2005
Posts: 20279

Use a javax.swing.Timer to call repaint() on the component on which you draw the image.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Information about moving shapes
jQuery in Action, 3rd edition