File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Move an image across a screen ?

 
Avin Sinanan
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I am building an Application..NOT an APPLET... and I need to know how to move a Gif File from one point to another. Lets say I want to move teh gif file from point (10,10) on the JPanel to point (50, 90). The image must move in a smooth motion between those points. How do I perfrom this animation?
any one have any code?
Thanks
 
Terence Doyle
Ranch Hand
Posts: 328
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avin,
This type of animation is usually done by painting the image in different positions accross the screen between the two points. Generally a for loop with a Thread.sleep( x milis ) will do the trick.
Be aware however that if you don't put this painting into a background thread your application will be "frozen" to user input while the painting takes place.
I suggest you search on the Sun site for "SwingWorker" and you'll find a nice little implementation for Swing applications.
Hope that helps,
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic