Is there a way to code a simple animation such as a picture moving across the screen in a GUI (and not an applet) that uses very little code and is easy to understand?
Printable View
Is there a way to code a simple animation such as a picture moving across the screen in a GUI (and not an applet) that uses very little code and is easy to understand?
There is swing timer you can use. On a tick event you can change the image location on a panel.
Sure!
and therein lies the rub!Quote:
that uses very little code and is easy to understand?
For me, I found that graphics programming was counter-intuitive, especially at first. You really need to read, study, and learn from a decent tutorial on this, but fortunately such a site exists. Please check out:
Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI with JFC/Swing)
and specifically: Refining the Design (The Java™ Tutorials > Creating a GUI with JFC/Swing > Performing Custom Painting)
Good luck!