• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Information about moving shapes

 
Hugh Thompson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

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,
Hugh
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a javax.swing.Timer to call repaint() on the component on which you draw the image.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic