org.jdesktop.animation.transitions
Class Effect

java.lang.Object
  extended by org.jdesktop.animation.transitions.Effect
Direct Known Subclasses:
CompositeEffect, Fade, Move, Rotate, Scale, Unchanging

public abstract class Effect
extends java.lang.Object

This is the base class for all effects that are used during screen transitions. Subclasses of this base class may override the init(), setup() and paint() methods to achieve the desired effect.


Constructor Summary
Effect()
           
 
Method Summary
 void cleanup(org.jdesktop.animation.timing.Animator animator)
          Effect subclasses that create temporary objects for the transition (such as in the init() method) should override this method and clean up those resources.
protected  javax.swing.JComponent getComponent()
           
 java.awt.Image getComponentImage()
           
 ComponentState getEnd()
           
 boolean getRenderComponent()
           
 ComponentState getStart()
           
 void init(org.jdesktop.animation.timing.Animator animator, Effect parentEffect)
           
 void paint(java.awt.Graphics2D g2d)
          This method is called during each frame of the transition animation, after the call to setup().
 void setBounds(int x, int y, int width, int height)
           
 void setBounds(java.awt.Rectangle bounds)
           
protected  void setComponentImage(java.awt.Image componentImage)
           
 void setComponentStates(ComponentState start, ComponentState end)
          Sets both the start and end states of this Effect.
 void setEnd(ComponentState end)
          Sets the end state of this Effect.
 void setHeight(int height)
           
 void setLocation(java.awt.Point location)
           
 void setRenderComponent(boolean renderComponent)
           
 void setStart(ComponentState start)
          Sets the start state of this Effect.
 void setup(java.awt.Graphics2D g2d)
          This method is called during each frame of the transition animation, prior to the call to paint().
 void setWidth(int width)
           
 void setX(int x)
           
 void setY(int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Effect

public Effect()
Method Detail

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)

setBounds

public void setBounds(java.awt.Rectangle bounds)

setLocation

public void setLocation(java.awt.Point location)

setX

public void setX(int x)

setY

public void setY(int y)

setWidth

public void setWidth(int width)

setHeight

public void setHeight(int height)

getComponent

protected javax.swing.JComponent getComponent()

init

public void init(org.jdesktop.animation.timing.Animator animator,
                 Effect parentEffect)

cleanup

public void cleanup(org.jdesktop.animation.timing.Animator animator)
Effect subclasses that create temporary objects for the transition (such as in the init() method) should override this method and clean up those resources. For example, TimingTarget e.g., PropertySetter) objects added to Animator should be removed after the transition to avoid leaking resources that may otherwise be retained by those objects.


setRenderComponent

public void setRenderComponent(boolean renderComponent)

getRenderComponent

public boolean getRenderComponent()

setComponentStates

public void setComponentStates(ComponentState start,
                               ComponentState end)
Sets both the start and end states of this Effect.


setStart

public void setStart(ComponentState start)
Sets the start state of this Effect.


getStart

public ComponentState getStart()

setEnd

public void setEnd(ComponentState end)
Sets the end state of this Effect.


getEnd

public ComponentState getEnd()

getComponentImage

public java.awt.Image getComponentImage()

setComponentImage

protected void setComponentImage(java.awt.Image componentImage)

setup

public void setup(java.awt.Graphics2D g2d)
This method is called during each frame of the transition animation, prior to the call to paint(). Subclasses will implement this method to set up the Graphic state, or other related state, that will be used in the following call to the paint() method. Note that changes to the Graphics2D object here will still be present in the Graphics2D object that is passed into the paint() method, so this is a good time to set up things such as transform state.

Parameters:
g2d - the Graphics2D destination for this rendering

paint

public void paint(java.awt.Graphics2D g2d)
This method is called during each frame of the transition animation, after the call to setup(). Subclasses may implement this method to perform whatever rendering is necessary to paint the transitioning component into the Graphics2D object with the desired effect. Most subclasses may elect to not override this at all, as the Effect version of the method already handles the basic painting operation. Only subclasses that need facilities beyond the basic drawing of the component or an image representation of the component should consider overriding.

Parameters:
g2d - The Graphics2D destination for this rendering. Note that the state of this Graphics2D object is affected by the previous call to setup so there may be no more need to perturb the graphics state further. Functionality in thihs method should focus, instead, on the rendering details instead of the graphics state.