moving and image from one point to another

Has anyone any idea how to animate an image to move from one point to another in a straight line
[103 byte] By [fcatowna] at [2007-10-2 14:52:50]
# 1

You will need to translate the Graphics2D context over a set of coordinates.

Have a timer that changes the coordinates over a given period. Then translate (AffineTransform) the Graphics2D context based on the coordinates that are being changed by your timer.

Do the translate in the paint method of your component and update the translate coordinates in a seperate thread.

Hope this helps.

jspflya at 2007-7-13 13:32:06 > top of Java-index,Desktop,Developing for the Desktop...