bgroenks
bgroenks

Reputation: 1889

Java: How to do GUI animations?

In all my time so far working with Java and its Swing GUI framework, I've never quite figured out (or even attempted to try) how to make the interface animate components.

Say I wanted the screen to slide left into the next screen or have a JLabel "fly" to a new location. Perhaps you want a menu to smoothly open in an animated fashion. How does this work?

Do you have to use SwingWorker? Even if that's the case... how can you control the painting of components if the layout manager is already doing that?

Upvotes: 0

Views: 4448

Answers (3)

tenorsax
tenorsax

Reputation: 21233

Take a look at Trident library. You can use it to interpolate various properties in your class.

Upvotes: 2

stryba
stryba

Reputation: 2028

Have a look at the book Filthy Rich Clients, you will find some really good answers there.

Upvotes: 4

mKorbel
mKorbel

Reputation: 109823

I think that there no reason for use SwingWorker, SwingWorker is designated for running long Backgroung Task(s) on output would be on Event dispatch Thread,

For animations in Swing is there javax.swing.Timer, examples here

Upvotes: 2

Related Questions