Reputation: 224
I'm writing a small application which aims to display a catalogue on screen. The window is splitted in three main blocks: On the left I have the articles' list, on the right a panel for image rendering and under this last component I have some labels for the information.
Now when I select an article I paint the image on the panel and fill the information's into the labels. When I have more than one image associated with the selected article I start a swing timer and I swap the images Evey 5 seconds...
How can I make the photo change more pretty introducing some fancy animations on image change? Do you know any library that could me help? If you do that directly by code an example and a little explanation would be great.
Thanks in advance Marco
Upvotes: 3
Views: 1809
Reputation: 10153
You can do some basic animation pretty easily with basic Java2D features, but it will take some more effort to add something actually interesting.
You can check out my own library demo (source included) for the ImageTransitionPanel example - it allows to perform a transition between two different Swing components with some interesting animations:
Web Look and Feel demo
There is also a full source of the ImageTransitionPanel included in the demo and sources. That class basically creates all of the transition effects and performs the transition.
Upvotes: 3
Reputation: 205795
You can have endless fun with the getSubImage()
method of BufferedImage
, illustrated here, and AlphaComposite
, illustrated here. See also the Java 2D API.
Upvotes: 2