File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to move images?

 
Avin Sinanan
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try playing with this:
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic