Hello!
I am writing an application for an embedded system with GUI written in swing. I now want to incorporate animations in the GUI to enhance usability.

Hypothetical example:
The user sees a table with some buttons ant things around it. The user can temporarily "save" the table, which makes the table dissapear into a status icon and a new empty table is shown. The user can then switch between these two tables.

The functionality for doing this is already there, but what I want to do now is to animate the dissaperance of the table so that it becomes more clear to the user that the saved table went into the status icon. I want to do this by animating the "minimization".

My question is the following. Are there any animation frameworks for java that makes this possible? I've google around some and found the "timing framework". Does anyone have some experience of this, or maybe something else that may fit my description?

Thanks

/S

Animation in Swing isn't hard to set up. Use a javax.swing.timer to run a method every (eg) 50mSec. In that method update the sizes/positions etc of your animated objects, and call repaint() for the JPanel (or whatever) that contains your animation to trigger a screen update. Override the paintComponent method for your JPanel to draw your animated objects at their latest positions/sizes etc (as updated by the timer (don't update these in the paintComponent).
The hard bit is the "artistic" effects. Have a look at the AffineTransform class that does things like shrinking/ skewing/squashing graphics objects - this may be a good way to get the effect of shrinking nd squashing down from a full GUI component to a icon and v.v.
Overall it's not hard to animate something smoothly in Java, but it's time consuming to get it to look really good by trial & error.

At a completely different level (and maybe not a solution to your particular requirement) have a look at JavaFX

Edited 5 Years Ago by JamesCherrill: n/a

I was thinking more of the whole package with the artistic part included. Coding a custom animation shouldn't be to timeconsuming, but as you said, the hard part is the quality of the animation effects.

This article has been dead for over six months. Start a new discussion instead.