• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a question. In an enviroment such as JPanel or Frame or FSEM mode(assuming that setIgnoreRepaint is false), how can you create an animation, with such as moving a picture, in both 2 ways:

1.With a specific timer (Thread.sleep() for example), and then auto-activates
2.With a certain input (keyboard prefered)

If you know how to animate without repaint() (setIgnoreRepaint(true)),
then I will also accept that.


Thank you.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The demo applets that come with the JDK are mostly animations, so if you simply need to see how you might create an animation, then those are as good a place to start as any.

But you seem to be asking something else -- how to start an animation based on some event? That of course depends on how you're doing the animation, but in general, just write code which, when the event occurs, creates and starts a Thread that runs the animation loop. If you need more details than that, then I think you'd have to ask a more specific question.
reply
    Bookmark Topic Watch Topic
  • New Topic