com.sas.visuals
Class ImageAnimationIcon

com.sas.visuals.ImageAnimationIcon
All Implemented Interfaces:
AnimationIconInterface, com.sas.visuals.IconInterface, com.sas.visuals.PainterInterface, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ImageAnimationIcon
implements AnimationIconInterface

ImageAnimationIcon is a class that allows for incrementing and decrementing over a set of images that are then displayed in the new state. The ImageAnimationIcon displays .jpg or .gif image files. The images can be scrolled or flipped through in several directions.

Notes:


See Also:
AnimationIconInterface, AnimationIconView, ImageAnimation, Serialized Form

Field Summary
protected  boolean appletRelative
           
protected  java.awt.Dimension[] dim
           
protected  int direction
           
protected  int height
           
protected  java.util.Vector images
           
protected  boolean imageScroll
           
protected  java.lang.String[] imageSources
           
protected  java.net.URL[] imageURLs
           
protected  ImageView img
           
protected  int imgIndex
           
protected  java.awt.Dimension maxD
           
protected  java.awt.Point maxPos
           
protected  int numberOfImages
           
protected  java.awt.Image offScreen
           
protected  java.awt.Graphics offScreenGraphics
           
protected  java.awt.Point[] pos
           
protected  int scrollingSpeed
           
protected  int startPosition
           
protected  java.awt.MediaTracker tracker
           
protected  int width
           
 
Constructor Summary
ImageAnimationIcon()
          Default constructor.
 
Method Summary
 void decrement()
          Decrement the position of the images if scolling or the image to be displayed if not scolling.
 int getDirection()
          Get the direction the images will scroll in if imageScroll property is true.
 java.awt.Insets getInsets()
          Return Insets(0,0,0,0)
 java.awt.Dimension getPreferredSize()
          Get the preferredSize of the images.
 int getScrollingSpeed()
          Get the speed at which the images will scroll.
 java.lang.String[] getSequence()
          Return the sequence of file names for the images to be displayed.
 java.net.URL[] getURLSequence()
          Return the sequence of file names for the images to be displayed.
 void increment()
          Increment the position of the images if scolling or the image to be displayed if not scolling.
 boolean isImageScroll()
          Return if the images are supposed to scroll over the preferredSize of the ImageAnimationIcon component.
 boolean isSourceAppletRelative()
           
protected  void loadDimensions()
          Load the dimensions of the loaded image objects.
protected  java.awt.Image loadImage(java.lang.String source)
          Load an image from an image name.
protected  java.awt.Image loadImage(java.net.URL source)
           
protected  java.awt.Image[] loadImageSequence(java.lang.String[] srcs)
          Load the java.awt.Image objects based on the image file names.
protected  java.awt.Image[] loadImageSequence(java.net.URL[] srcs)
          Load the java.awt.Image objects based on the image URL.
protected  void loadPositions()
          Load the positions of the loaded image objects.
 void paint(java.awt.Component comp, java.awt.Graphics g, int x, int y, int width, int height)
          Paint the component.
 void paintAnimation(java.awt.Component comp, java.awt.Graphics g, int x, int y, int width, int height)
          Paint the images at their current positions.
 void reset()
          Reset the object state to its initial state.
 void setDefaultValues()
          Set the default internal values for the ImageAnimationIcon.
 void setDirection(int d)
          Set the direction the images will scroll in if imageScroll property is true.
 void setImageScroll(boolean s)
          Set the display of the images to scroll.
 void setImageSequence(java.awt.Image[] imgs)
           
 void setPreferredSize(java.awt.Dimension d)
          Set the preferredSize of the images.
 void setScrollingSpeed(int s)
          Set the speed at which the images will scroll.
 void setSequence(java.lang.String[] sources)
          Set the sequence of file names for the images to be displayed.
 void setSourceAppletRelative(boolean b)
           
 void setURLSequence(java.net.URL[] sources)
           
 

Field Detail

width

protected int width

height

protected int height

direction

protected int direction

scrollingSpeed

protected int scrollingSpeed

appletRelative

protected boolean appletRelative

imageScroll

protected boolean imageScroll

imageSources

protected java.lang.String[] imageSources

imageURLs

protected java.net.URL[] imageURLs

maxD

protected transient java.awt.Dimension maxD

startPosition

protected transient int startPosition

imgIndex

protected transient int imgIndex

numberOfImages

protected transient int numberOfImages

tracker

protected transient java.awt.MediaTracker tracker

maxPos

protected transient java.awt.Point maxPos

offScreen

protected transient java.awt.Image offScreen

offScreenGraphics

protected transient java.awt.Graphics offScreenGraphics

images

protected transient java.util.Vector images

dim

protected transient java.awt.Dimension[] dim

pos

protected transient java.awt.Point[] pos

img

protected transient ImageView img
Constructor Detail

ImageAnimationIcon

public ImageAnimationIcon()
Default constructor.

Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
Get the preferredSize of the images.

Specified by:
getPreferredSize in interface com.sas.visuals.IconInterface
Overrides:
getPreferredSize in class java.awt.Component
See Also:
setPreferredSize(java.awt.Dimension), IconInterface

setPreferredSize

public void setPreferredSize(java.awt.Dimension d)
Set the preferredSize of the images. This is used only when the images are scrolling.

Overrides:
setPreferredSize in class java.awt.Component
See Also:
getPreferredSize(), IconInterface

getDirection

public int getDirection()
Get the direction the images will scroll in if imageScroll property is true.

Returns:
a com.sas.visuals.Direction value
See Also:
setDirection(int)

getScrollingSpeed

public int getScrollingSpeed()
Get the speed at which the images will scroll. This is the number of pixels the images will be moved at each increment/decrement.


getInsets

public java.awt.Insets getInsets()
Return Insets(0,0,0,0)

Specified by:
getInsets in interface com.sas.visuals.PainterInterface
See Also:
PainterInterface

getSequence

public java.lang.String[] getSequence()
Return the sequence of file names for the images to be displayed.

Returns:
an array of image file names
See Also:
setSequence(java.lang.String[])

getURLSequence

public java.net.URL[] getURLSequence()
Return the sequence of file names for the images to be displayed.

Returns:
an array of image file names
See Also:
setURLSequence(java.net.URL[])

isImageScroll

public boolean isImageScroll()
Return if the images are supposed to scroll over the preferredSize of the ImageAnimationIcon component.

See Also:
setImageScroll(boolean)

setImageScroll

public void setImageScroll(boolean s)
Set the display of the images to scroll.

Parameters:
s - if true the images will scroll over the preferredSize; otherwise the images will be displayed in sequence in the same position.
See Also:
isImageScroll()

isSourceAppletRelative

public boolean isSourceAppletRelative()

setSourceAppletRelative

public void setSourceAppletRelative(boolean b)

setDirection

public void setDirection(int d)
Set the direction the images will scroll in if imageScroll property is true.

Parameters:
d - a com.sas.visuals.Direction value
See Also:
getDirection()

setScrollingSpeed

public void setScrollingSpeed(int s)
Set the speed at which the images will scroll.


setSequence

public void setSequence(java.lang.String[] sources)
Set the sequence of file names for the images to be displayed.

Parameters:
sources - an array of image file names
See Also:
getSequence()

setURLSequence

public void setURLSequence(java.net.URL[] sources)

setImageSequence

public void setImageSequence(java.awt.Image[] imgs)

reset

public void reset()
Reset the object state to its initial state.

Specified by:
reset in interface AnimationIconInterface
See Also:
AnimationIconInterface

increment

public void increment()
Increment the position of the images if scolling or the image to be displayed if not scolling.

Specified by:
increment in interface AnimationIconInterface
See Also:
AnimationIconInterface

decrement

public void decrement()
Decrement the position of the images if scolling or the image to be displayed if not scolling.

Specified by:
decrement in interface AnimationIconInterface
See Also:
AnimationIconInterface

paint

public void paint(java.awt.Component comp,
                  java.awt.Graphics g,
                  int x,
                  int y,
                  int width,
                  int height)
Paint the component.

Specified by:
paint in interface com.sas.visuals.PainterInterface
Parameters:
comp - the java.awt.Component to paint on
g - the graphics context to use for painting
x - the x coordinate
y - the y coordinate
width - the width
height - the height

paintAnimation

public void paintAnimation(java.awt.Component comp,
                           java.awt.Graphics g,
                           int x,
                           int y,
                           int width,
                           int height)
Paint the images at their current positions.

Specified by:
paintAnimation in interface AnimationIconInterface
Parameters:
comp - the java.awt.Component to paint on
g - the graphics context to use for painting
x - the x coordinate
y - the y coordinate
width - the width
height - the height
See Also:
PainterInterface.paint(java.awt.Component, java.awt.Graphics, int, int, int, int)

loadImageSequence

protected java.awt.Image[] loadImageSequence(java.lang.String[] srcs)
Load the java.awt.Image objects based on the image file names.

Parameters:
srcs - the image file names

loadImageSequence

protected java.awt.Image[] loadImageSequence(java.net.URL[] srcs)
Load the java.awt.Image objects based on the image URL.

Parameters:
srcs - the image file names

loadDimensions

protected void loadDimensions()
Load the dimensions of the loaded image objects.


loadPositions

protected void loadPositions()
Load the positions of the loaded image objects.


loadImage

protected java.awt.Image loadImage(java.lang.String source)
Load an image from an image name.

Parameters:
source - the source can be the image file name and path or a URL to the image file name and path.
Returns:
the loaded Image

loadImage

protected java.awt.Image loadImage(java.net.URL source)

setDefaultValues

public void setDefaultValues()
Set the default internal values for the ImageAnimationIcon.




Copyright © 2009 SAS Institute Inc. All Rights Reserved.