Tag Archives: Swing

Swing Animation – Fifth Shot

A quick post to propose an upgrade of the AnimatedPanel that provide a new AnimationListener interface that allow to listen to AnimationEvent. For now there is two main event type, one for animationStarted() and one for animationFinished(). You will find in the AnimationEvent the source objet (the AnimatedPanel) and the AnimationState that indicates if it is a ShowingAnimation or HidingAnimation.

I have also corrected some bugs. Previous release use a single snapshot version of the panel to perform the animation. Now a new snapshot is done every time animation starts. It is no longer allowed to perform double showing animation or hiding animation.

Many thanks to NPI that used for the first time my libs on a real business application. I appreciate the new features you proposed and how you give me feedback on the existing bugs 😉

Coming soon a release that contains all the swing animation I wrote where animation event will be included for all components.

LoNee

Swing Animation – Fourth shot

A quick post to notify an update of the AnimatedTabbedPane. Writing some new animations for this swing component makes me realize that animations shall be custom writable, and i might try to write some code that allow to easily create animated visual beans, without starting from scratch all the time…

I will not describe the new animations of the tabbed pane here, you’ll just have to play with the demo !

Jar with code and example to launch available on download page !

Lonee

Swing Animation – Third shot

Still playing with swing component and animation, I tried to make a generic panel that propose animations on visibility change. Here is the AnimatedPanel swing component.

Note AnimatedPanel inherits from JPanel. It only offers extra methods setAnimationType(AnimationType animationType) with the following possibilities :

  • None : no animation, it works like a classic JPanel
  • SlideAnimationFromBackground : a sliding animation where the panel arrives from the background
  • SlideAnimationFromLeft : a sliding animation where the panel arrives from the left
  • SlideAnimationFromRight : a sliding animation where the panel arrives from the right
  • SlideAnimationFromTop : a sliding animation where the panel arrives from the top
  • SlideAnimationFromBottom : a sliding animation where the panel arrives from the bottom
  • Custom : use the setCustomAnimation(Animation animation) method to propose your own animation implementation !

Here is the interface contract an animation must match:
public AffineTransform getAnimationAffineTransform(
AffineTransform affineTransform, float animationStep,
AnimatedPanel animatedPanel);

In fact it has to modify and return the affineTransform. It shall use the animationStep (0.0<=step<=1.0) and maybe the animatedPanel informations (width, height ?) to do the affineTransform update.

It also offers a setTransparencyOnAnimation(boolean use) method in order to use a panel fading effect on visibility change.

You can find a custom animation exemple in the test code.

Hope you will enjoy this.

Jar with code and example to launch available on download page !

Lonee

Swing Animation – Second shot !

I continue to play with timing framework and swing component in order to perform swing cool animation effect. Today I propose :

Note AnimatedTabbedPane inherits from JTabbedPane. It only offers and extra method setAnimationType(AnimationType animationType) with the following possibilities :

  • None : no animation, it works like a classic JTabbedPane
  • Fade : a fade animation between the previous panel and the next one is used
  • SlideLeftToRight : a sliding anoimation where previous panel is pushed to the right by the next one
  • SlideRightToLeft : a sliding anoimation where previous panel is pushed to the left by the next one
  • SlideAccordingIndex : a sliding animation where previous pane is pushed by the next one depending the tab relative index

Hope you will enjoy this.

Jar with code and example to launch available on download page !

Lonee