wood burning stoves*
The moose likes Java in General and the fly likes How to move images? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to move images?" Watch "How to move images?" New topic
Author

How to move images?

Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Hey does anyone out there know how to move an image across the screen for an application.. The image has to move smotthely between two points. for example the image ha sto move somtthly between (10,10) and (90,60).
Is there anyway tos et how fast it moves between these two points?
Anyone have any code.. teh www.java.sun.com site is not very helpful.. it only has for applets and am doing applications and the code they give you is so limited... any suggestions or code?
thanks


yours respectfully<br />Avin Sinanan
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Try playing with this:
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Originally posted by Avin Sinanan:
The image has to move smoothly between two points.

Hello,
If you don't like so much flickering, you might want to explore double buffering. Here is Cindy's code with some double buffering for a smoother animation:

Note: You can adjust the timing with the "Thread.sleep(50);" part.
Good Luck,
-Dirk Schreckmann


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
Don't get me started about those stupid light bulbs.
 
subject: How to move images?