3

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

Marco Capoferri
  • 224
  • 2
  • 12

2 Answers2

3

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.

Mikle Garin
  • 10,083
  • 37
  • 59
  • Sound good! This weekend I'll give a try but I think that your library can perfectly fit my needs. Thanks a lot! – Marco Capoferri Apr 18 '12 at 22:57
  • Anyways feel free to "extract" the ImageTransitionPanel component source in case other functionality is useless for you. – Mikle Garin Apr 18 '12 at 23:46
  • Can you provide some screenshots of web l&f on your website? Because it seems to be pretty and cool. Maybe i can use it as option theme for the app... if you agree, obviously. – Marco Capoferri Apr 19 '12 at 23:11
  • I already thought about adding some screenshots and description to main page. I guess i will do that soon. And yes - you can use WebLaF theme if you like it :) – Mikle Garin Apr 20 '12 at 06:39
2

You can have endless fun with the getSubImage() method of BufferedImage, illustrated here, and AlphaComposite, illustrated here. See also the Java 2D API.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045