com.sas.visuals
Class MarqueeIcon

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

public class MarqueeIcon
implements AnimationIconInterface

MarqueeIcon is a class that displays text and an image that when incremented or decremented moves there position based on the direction the marquee is set to.

See Also:
AnimationIconInterface, Marquee, Serialized Form

Field Summary
protected  boolean appletRelative
           
protected  int count
           
protected  java.awt.Dimension currentTextSize
           
protected  int direction
           
protected  int hContentAlign
           
protected  int hImageAlign
           
protected  int hTextAlign
           
protected  int imageAnimationSpeed
           
protected  java.util.Vector images
           
protected  java.awt.Dimension imageSize
           
protected  java.lang.String[] imageSources
           
protected  java.net.URL[] imageURLs
           
protected  ImageView img
           
protected  int imgTextGap
           
protected  java.util.Vector lineWidths
           
protected  com.sas.collection.StringCollection multilineText
           
protected  java.awt.Image offScreen
           
protected  java.awt.Graphics offScreenGraphics
           
protected  java.lang.String precedingText
           
protected  java.awt.Font prevFont
           
protected  int rollingI
           
protected  int scrollingSpeed
           
protected  int startingPosition
           
protected  java.lang.String text
           
protected  int textJustification
           
protected  int textPosition
           
protected  java.awt.MediaTracker tracker
           
protected  java.lang.String trailingText
           
protected  int vContentAlign
           
protected  int vImageAlign
           
protected  int vTextAlign
           
 
Constructor Summary
MarqueeIcon()
          Default constructor.
 
Method Summary
 void decrement()
          Decrement the position of the marquee content.
 int getDirection()
          Get the direction of the content movement.
 int getHorizontalContentAlignment()
          Get the horizontal content alignment.
 int getHorizontalImageAlignment()
          Get the horizontal image alignment.
 int getHorizontalTextAlignment()
          Get the horizontal text alignment.
 int getImageAnimationSpeed()
          Get the image animation speed.
 int getImageTextGap()
          Get the gap between the text and the image.
 java.awt.Insets getInsets()
          Get the insets for the MarqueeIcon.
 java.awt.Dimension getPreferredSize()
          Get the preferredSize of the MarqueeIcon.
 int getScrollingSpeed()
          Get the speed at which the contents scroll across the Marquee component.
 java.lang.String[] getSourceSequence()
          Get the sequence of image file names for the images to be displayed on the Marquee.
 java.lang.String getText()
          Get the text displayed in the marquee.
 int getTextJustification()
          Get the justification of the text.
 int getTextPosition()
          Get the position of the text relative to the image.
 java.net.URL[] getURLSequence()
          Returns an array of URLs that contain the sources of the images to be displayed
 int getVerticalContentAlignment()
          Get the vertical content alignment.
 int getVerticalImageAlignment()
          Get the vertical image alignment.
 int getVerticalTextAlignment()
          Get the vertical text alignment.
 void increment()
          Increment the position of the marquee content.
 boolean isSourceAppletRelative()
          Indicates whether or not the images' source path is relative to where the applet is loaded from.
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 loadImageSize()
          Load the dimensions 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 marquee.
 void paintAnimation(java.awt.Component comp, java.awt.Graphics g, int x, int y, int width, int height)
          Paint the MarqueeIcon in its current state.
protected  void paintContent(java.awt.Component comp, java.awt.Graphics g, int x, int y, int width, int height)
          Paint the text and image of the MarqueeIcon.
 void reset()
          Reset the marquee state to its initial state.
 void setDefaultValues()
          Set the default internal values for the AnimationIconView.
 void setDirection(int d)
          Set the direction to scroll the Marquee.
 void setHorizontalContentAlignment(int align)
          Set the horizontal content alignment.
 void setHorizontalImageAlignment(int align)
          Set the horizontal image alignment.
 void setHorizontalTextAlignment(int align)
          Set the horizontal text alignment.
 void setImageAnimationSpeed(int animateSpeed)
          Set the image animation speed.
 void setImageSequence(java.awt.Image[] imgs)
          Sets images to hold all the items in the Image array passed in
 void setImageTextGap(int g)
          Set the gap between the text and the image.
 void setScrollingSpeed(int speed)
          Set the speed at which the contents scroll across the Marquee component.
 void setSourceAppletRelative(boolean b)
          Sets whether or not the images' source path is relative to where the applet is loaded from.
 void setSourceSequence(java.lang.String[] sources)
          Set the sequence of file names for the images to be displayed.
 void setText(java.lang.String txt)
          Set the text displayed in the marquee.
 void setTextJustification(int j)
          Set the text justification.
 void setTextPosition(int pos)
          Set the position of the text relative to the image.
 void setURLSequence(java.net.URL[] sources)
          Sets the sources of images in an array of URLs
 void setVerticalContentAlignment(int align)
          Set the vertical content alignment.
 void setVerticalImageAlignment(int align)
          Set the vertical image alignment.
 void setVerticalTextAlignment(int align)
          Set the vertical text alignment.
 

Field Detail

precedingText

protected java.lang.String precedingText

trailingText

protected java.lang.String trailingText

text

protected java.lang.String text

imgTextGap

protected int imgTextGap

hContentAlign

protected int hContentAlign

vContentAlign

protected int vContentAlign

hTextAlign

protected int hTextAlign

vTextAlign

protected int vTextAlign

hImageAlign

protected int hImageAlign

vImageAlign

protected int vImageAlign

direction

protected int direction

scrollingSpeed

protected int scrollingSpeed

imageAnimationSpeed

protected int imageAnimationSpeed

startingPosition

protected int startingPosition

textPosition

protected int textPosition

textJustification

protected int textJustification

imageSources

protected java.lang.String[] imageSources

imageURLs

protected java.net.URL[] imageURLs

appletRelative

protected boolean appletRelative

prevFont

protected transient java.awt.Font prevFont

imageSize

protected transient java.awt.Dimension imageSize

currentTextSize

protected transient java.awt.Dimension currentTextSize

multilineText

protected transient com.sas.collection.StringCollection multilineText

offScreen

protected transient java.awt.Image offScreen

offScreenGraphics

protected transient java.awt.Graphics offScreenGraphics

count

protected transient int count

rollingI

protected transient int rollingI

images

protected transient java.util.Vector images

lineWidths

protected transient java.util.Vector lineWidths

tracker

protected transient java.awt.MediaTracker tracker

img

protected transient ImageView img
Constructor Detail

MarqueeIcon

public MarqueeIcon()
Default constructor.

Method Detail

getPreferredSize

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

Specified by:
getPreferredSize in interface com.sas.visuals.IconInterface
Overrides:
getPreferredSize in class java.awt.Component

getDirection

public int getDirection()
Get the direction of the content movement.

See Also:
Direction, setDirection(int)

getTextJustification

public int getTextJustification()
Get the justification of the text.

Returns:
one of LEFT, RIGHT, or CENTER.
See Also:
setTextJustification(int)

getHorizontalContentAlignment

public int getHorizontalContentAlignment()
Get the horizontal content alignment.

Returns:
a horizontal alignment value: LEFT, RIGHT, or CENTER.
See Also:
setHorizontalContentAlignment(int)

getVerticalContentAlignment

public int getVerticalContentAlignment()
Get the vertical content alignment.

Returns:
a vertical alignment value: TOP, BOTTOM, or CENTER.
See Also:
setVerticalContentAlignment(int)

getHorizontalTextAlignment

public int getHorizontalTextAlignment()
Get the horizontal text alignment.

Returns:
a horizontal alignment value: LEFT, RIGHT, or CENTER.
See Also:
setHorizontalTextAlignment(int)

getVerticalTextAlignment

public int getVerticalTextAlignment()
Get the vertical text alignment.

Returns:
a vertical alignment value: TOP, BOTTOM, or CENTER.
See Also:
setVerticalTextAlignment(int)

getHorizontalImageAlignment

public int getHorizontalImageAlignment()
Get the horizontal image alignment.

Returns:
a horizontal alignment value: LEFT, RIGHT, or CENTER.
See Also:
setHorizontalImageAlignment(int)

getVerticalImageAlignment

public int getVerticalImageAlignment()
Get the vertical image alignment.

Returns:
a vertical alignment value: TOP, BOTTOM, or CENTER.
See Also:
setVerticalImageAlignment(int)

getImageAnimationSpeed

public int getImageAnimationSpeed()
Get the image animation speed.

Returns:
the speed the images are being switched
See Also:
setImageAnimationSpeed(int)

getImageTextGap

public int getImageTextGap()
Get the gap between the text and the image.

Returns:
the pixel value space between the text and the image.
See Also:
setImageTextGap(int)

getInsets

public java.awt.Insets getInsets()
Get the insets for the MarqueeIcon.

Specified by:
getInsets in interface com.sas.visuals.PainterInterface
Returns:
new Insets(0,0,0,0)

getText

public java.lang.String getText()
Get the text displayed in the marquee.

See Also:
setText(java.lang.String), StringDataInterface

getTextPosition

public int getTextPosition()
Get the position of the text relative to the image.

Returns:
the text position: TOP, BOTTOM, LEFT, or RIGHT.
See Also:
setTextPosition(int)

getScrollingSpeed

public int getScrollingSpeed()
Get the speed at which the contents scroll across the Marquee component.

Returns:
the content scrolling speed.
See Also:
setScrollingSpeed(int)

getSourceSequence

public java.lang.String[] getSourceSequence()
Get the sequence of image file names for the images to be displayed on the Marquee.

Returns:
sequence of image file names
See Also:
setImageSequence(java.awt.Image[])

getURLSequence

public java.net.URL[] getURLSequence()
Returns an array of URLs that contain the sources of the images to be displayed

Returns:
and array of URLs
See Also:
setURLSequence(java.net.URL[])

isSourceAppletRelative

public boolean isSourceAppletRelative()
Indicates whether or not the images' source path is relative to where the applet is loaded from.

Returns:
boolean flag appletRelative
See Also:
setSourceAppletRelative(boolean)

setSourceAppletRelative

public void setSourceAppletRelative(boolean b)
Sets whether or not the images' source path is relative to where the applet is loaded from.

See Also:
setSourceAppletRelative(boolean)

setDirection

public void setDirection(int d)
Set the direction to scroll the Marquee.

Parameters:
d - one of the Direction values.
See Also:
Direction, getDirection()

setTextJustification

public void setTextJustification(int j)
Set the text justification.

Parameters:
j - one of LEFT, RIGHT, or CENTER.
See Also:
getTextJustification()

setHorizontalContentAlignment

public void setHorizontalContentAlignment(int align)
Set the horizontal content alignment.

Parameters:
align - a horizontal alignment value: LEFT, RIGHT, or CENTER.
See Also:
getHorizontalContentAlignment()

setVerticalContentAlignment

public void setVerticalContentAlignment(int align)
Set the vertical content alignment.

Parameters:
align - a vertical alignment value: TOP, BOTTOM, or CENTER.
See Also:
getVerticalContentAlignment()

setHorizontalTextAlignment

public void setHorizontalTextAlignment(int align)
Set the horizontal text alignment.

Parameters:
align - a horizontal alignment value: LEFT, RIGHT, or CENTER.
See Also:
getHorizontalTextAlignment()

setVerticalTextAlignment

public void setVerticalTextAlignment(int align)
Set the vertical text alignment.

Parameters:
align - a vertical alignment value: TOP, BOTTOM, or CENTER.
See Also:
getVerticalTextAlignment()

setHorizontalImageAlignment

public void setHorizontalImageAlignment(int align)
Set the horizontal image alignment.

Parameters:
align - a horizontal alignment value: LEFT, RIGHT, or CENTER.
See Also:
getHorizontalImageAlignment()

setVerticalImageAlignment

public void setVerticalImageAlignment(int align)
Set the vertical image alignment.

Parameters:
align - a vertical alignment value: TOP, BOTTOM, or CENTER.
See Also:
getVerticalImageAlignment()

setImageAnimationSpeed

public void setImageAnimationSpeed(int animateSpeed)
Set the image animation speed.

Parameters:
animateSpeed - the speed the images are being switched
See Also:
getImageAnimationSpeed()

setImageTextGap

public void setImageTextGap(int g)
Set the gap between the text and the image.

Parameters:
g - the pixel value space between the text and the image.
See Also:
getImageTextGap()

setText

public void setText(java.lang.String txt)
Set the text displayed in the marquee.

See Also:
getText(), StringDataInterface

setTextPosition

public void setTextPosition(int pos)
Set the position of the text relative to the image.

Parameters:
pos - the text position: TOP, BOTTOM, LEFT, or RIGHT.
See Also:
getTextPosition()

setScrollingSpeed

public void setScrollingSpeed(int speed)
Set the speed at which the contents scroll across the Marquee component.

Parameters:
speed - the content scrolling speed.
See Also:
getScrollingSpeed()

setSourceSequence

public void setSourceSequence(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:
getSourceSequence()

setURLSequence

public void setURLSequence(java.net.URL[] sources)
Sets the sources of images in an array of URLs

Parameters:
sources - an array of URLs to be set on imageURLs
See Also:
getURLSequence()

setImageSequence

public void setImageSequence(java.awt.Image[] imgs)
Sets images to hold all the items in the Image array passed in

Parameters:
img - and array of Image objects

reset

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

Specified by:
reset in interface AnimationIconInterface

increment

public void increment()
Increment the position of the marquee content.

Specified by:
increment in interface AnimationIconInterface

decrement

public void decrement()
Decrement the position of the marquee content.

Specified by:
decrement in interface AnimationIconInterface

paint

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

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 MarqueeIcon in its current state.

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)

paintContent

protected void paintContent(java.awt.Component comp,
                            java.awt.Graphics g,
                            int x,
                            int y,
                            int width,
                            int height)
Paint the text and image of the MarqueeIcon.

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

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

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)

loadImageSize

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


setDefaultValues

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




Copyright © 2009 SAS Institute Inc. All Rights Reserved.