Class PhantomScroll

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----PhantomScroll

public class PhantomScroll
extends Applet
implements Runnable
The PhantomScroll applet is a horizontal text scroller with fade effects.


Variable Index

 o CENTER
Ease-of-use constant for bgDisplay parameter of setBackground method.
 o TILE
Ease-of-use constant for bgDisplay parameter of setBackground method.

Constructor Index

 o PhantomScroll()

Method Index

 o getActiveLinkColor()
Returns the active hyperlink color.
 o getAmplitude()
Returns the amplitude of the oscillation.
 o getAppletInfo()
Returns information about this applet.
 o getBackgroundColor()
Returns the background color.
 o getBackgroundImage()
Returns the background image.
 o getDelay()
Returns the delay between frames/iterations.
 o getForegroundColor()
Returns the foreground color.
 o getForegroundImage()
Returns the foreground image.
 o getLinkColor()
Returns the hyperlink color.
 o getParameterInfo()
Returns information about the parameters that are understood by this applet.
 o getPeriod()
Returns the period of the oscillation.
 o getSpeed()
Returns the speed
 o getTarget()
Returns the default target frame.
 o imageUpdate(Image, int, int, int, int, int)
Repaints the component when the image has changed.
 o init()
Initializes the applet.
 o mouseDown(Event, int, int)
This method is called when the mouse button is pushed inside this component.
 o mouseDrag(Event, int, int)
This method is called when the mouse button is moved inside this component with the button pushed.
 o mouseEnter(Event, int, int)
This method is called when the mouse first enters this component.
 o mouseExit(Event, int, int)
This method is called when the mouse exits this component.
 o mouseMove(Event, int, int)
This method is called when the mouse is moved inside this component with the mouse button not pushed.
 o mouseUp(Event, int, int)
This method is called when the mouse button is released inside this component.
 o paint(Graphics)
Paints the component.
 o preferredSize()
Determines the preferred size of the component.
 o resize(int, int)
Resizes this component to the specified width and height.
 o run()
Invoked when the scroller's internal thread is started through a call to the start method.
 o setActiveLinkColor(Color)
Sets the color of the hyperlink to which the mouse cursor is pointing
 o setAmplitude(int)
Sets the amplitude of the oscillation.
 o setBackground(Color)
Sets the background to a solid color.
 o setBackground(Image, Color, int)
Sets the background image.
 o setDelay(int)
Sets the frame rate.
 o setForeground(Color)
Sets the foreground to a solid color.
 o setForeground(Image)
Sets the foreground image pattern.
 o setLinkColor(Color)
Sets the color of the hyperlinks.
 o setPeriod(int)
Sets the period (inverse of frequency) of the oscillation.
 o setSpeed(int)
Sets the speed of the scrolling motion
 o setTarget(String)
Sets the default target frame.
 o setText(String, Font)
Sets the text to be scrolled.
 o setText(URL, Font)
Sets the text to be scrolled from a text file.
 o setTrail(double)
Sets the fading trail effect.
 o start()
Starts the scrolling animation.
 o stop()
Stops the scrolling animation.
 o update(Graphics)
Redraws the portion of the canvas that has been affected since the last animation frame.

Variables

 o TILE
 public static final int TILE
Ease-of-use constant for bgDisplay parameter of setBackground method. Indicates that the background image should be tiled.

See Also:
setBackground
 o CENTER
 public static final int CENTER
Ease-of-use constant for bgDisplay parameter of setBackground method. Indicates that the background image should be centered.

See Also:
setBackground

Constructors

 o PhantomScroll
 public PhantomScroll()

Methods

 o getAppletInfo
 public String getAppletInfo()
Returns information about this applet.

Returns:
the information
Overrides:
getAppletInfo in class Applet
 o getParameterInfo
 public String[][] getParameterInfo()
Returns information about the parameters that are understood by this applet.

Returns:
the information
Overrides:
getParameterInfo in class Applet
 o init
 public void init()
Initializes the applet. This method loads and processes the parameters.

Overrides:
init in class Applet
 o start
 public void start()
Starts the scrolling animation.

Overrides:
start in class Applet
See Also:
stop
 o stop
 public void stop()
Stops the scrolling animation.

Overrides:
stop in class Applet
See Also:
start
 o run
 public void run()
Invoked when the scroller's internal thread is started through a call to the start method. This method animates the scroller.

See Also:
start
 o update
 public void update(Graphics g)
Redraws the portion of the canvas that has been affected since the last animation frame.

Parameters:
g - the graphics context
Overrides:
update in class Container
See Also:
paint
 o paint
 public void paint(Graphics g)
Paints the component. This method is called when the contents of the component should be painted in response to the component first being shown or damage needing repair.

Parameters:
g - the graphics context
Overrides:
paint in class Container
See Also:
update
 o imageUpdate
 public boolean imageUpdate(Image img,
                            int flags,
                            int x,
                            int y,
                            int w,
                            int h)
Repaints the component when the image has changed. This method begins processing the background and foreground images after it has been notified that they have been completely loaded.

Parameters:
img - the image being observed
flags - see imageUpdate for more information
x - the x coordinate
y - the y coordinate
width - the width
height - the height
Returns:
true if the flags indicate that the image is completely loaded; false otherwise
Overrides:
imageUpdate in class Component
 o mouseEnter
 public boolean mouseEnter(Event event,
                           int x,
                           int y)
This method is called when the mouse first enters this component.

Parameters:
event - the event that caused the action
x - the x coordinate
y - the y coordiante
Returns:
true
Overrides:
mouseEnter in class Component
 o mouseExit
 public boolean mouseExit(Event event,
                          int x,
                          int y)
This method is called when the mouse exits this component.

Parameters:
event - the event that caused the action
x - the x coordinate
y - the y coordiante
Returns:
true
Overrides:
mouseExit in class Component
 o mouseUp
 public boolean mouseUp(Event event,
                        int x,
                        int y)
This method is called when the mouse button is released inside this component.

Parameters:
event - the event that caused the action
x - the x coordinate
y - the y coordiante
Returns:
true
Overrides:
mouseUp in class Component
 o mouseDown
 public boolean mouseDown(Event event,
                          int x,
                          int y)
This method is called when the mouse button is pushed inside this component.

Parameters:
event - the event that caused the action
x - the x coordinate
y - the y coordiante
Returns:
true
Overrides:
mouseDown in class Component
 o mouseMove
 public boolean mouseMove(Event event,
                          int x,
                          int y)
This method is called when the mouse is moved inside this component with the mouse button not pushed.

Parameters:
event - the event that caused the action
x - the x coordinate
y - the y coordiante
Returns:
true
Overrides:
mouseMove in class Component
 o mouseDrag
 public boolean mouseDrag(Event event,
                          int x,
                          int y)
This method is called when the mouse button is moved inside this component with the button pushed.

Parameters:
event - the event that caused the action
x - the x coordinate
y - the y coordiante
Returns:
true
Overrides:
mouseDrag in class Component
 o resize
 public void resize(int w,
                    int h)
Resizes this component to the specified width and height.

Parameters:
w - the width
h - the height
Overrides:
resize in class Applet
 o preferredSize
 public Dimension preferredSize()
Determines the preferred size of the component.

Returns:
the preferred size of this component
Overrides:
preferredSize in class Container
 o getBackgroundColor
 public Color getBackgroundColor()
Returns the background color.

Returns:
the background color
 o getBackgroundImage
 public Image getBackgroundImage()
Returns the background image.

Returns:
the background image
 o getForegroundColor
 public Color getForegroundColor()
Returns the foreground color.

Returns:
the foreground color
 o getForegroundImage
 public Image getForegroundImage()
Returns the foreground image.

Returns:
the foreground image
 o getLinkColor
 public Color getLinkColor()
Returns the hyperlink color.

Returns:
the hyperlink color
 o getActiveLinkColor
 public Color getActiveLinkColor()
Returns the active hyperlink color.

Returns:
the active hyperlink color
 o getSpeed
 public int getSpeed()
Returns the speed

Returns:
the number of pixels to shift between frames/iterations
 o getDelay
 public int getDelay()
Returns the delay between frames/iterations.

Returns:
the delay in milliseconds
 o getAmplitude
 public int getAmplitude()
Returns the amplitude of the oscillation.

Returns:
the number of pixels by which to oscillate in either direction
 o getPeriod
 public int getPeriod()
Returns the period of the oscillation.

Returns:
the number of frames/iteration to complet an oscillation
 o getTarget
 public String getTarget()
Returns the default target frame.

Returns:
the name of default target frame
 o setBackground
 public void setBackground(Image image,
                           Color color,
                           int display)
Sets the background image.

Parameters:
image - the image to be displayed in the background
color - the background color to use for any transparent pixels
display - the method by which to display the image
See Also:
TILE, CENTER
 o setBackground
 public void setBackground(Color color)
Sets the background to a solid color.

Parameters:
color - the background color
Overrides:
setBackground in class Component
 o setForeground
 public void setForeground(Image image)
Sets the foreground image pattern.

Parameters:
image - the foreground image
 o setForeground
 public void setForeground(Color color)
Sets the foreground to a solid color.

Parameters:
color - the foreground color
Overrides:
setForeground in class Component
 o setLinkColor
 public void setLinkColor(Color color)
Sets the color of the hyperlinks.

Parameters:
color - the hyperlink color
 o setActiveLinkColor
 public void setActiveLinkColor(Color color)
Sets the color of the hyperlink to which the mouse cursor is pointing

Parameters:
color - the hyperlink color
 o setSpeed
 public void setSpeed(int speed)
Sets the speed of the scrolling motion

Parameters:
speed - the number of pixels per animation frame
 o setDelay
 public void setDelay(int delay)
Sets the frame rate.

Parameters:
delay - the number of milliseconds between animation frames
 o setAmplitude
 public void setAmplitude(int amplitude)
Sets the amplitude of the oscillation.

Parameters:
amplitude - the number of pixels by which to oscillate in either direction
 o setPeriod
 public void setPeriod(int period)
Sets the period (inverse of frequency) of the oscillation.

Parameters:
period - the number of iterations/frames to complete one oscillation
 o setTrail
 public void setTrail(double intensity)
Sets the fading trail effect.

Parameters:
intensity - the intensity of the trail effect. Values range from 0.0 to 1.0.
 o setTarget
 public void setTarget(String target)
Sets the default target frame.

Parameters:
target - the default target
 o setText
 public void setText(URL path,
                     Font font)
Sets the text to be scrolled from a text file.

Parameters:
path - the path of the file that contains the text to be scrolled
font - the font to use in displaying the text
 o setText
 public void setText(String text,
                     Font font)
Sets the text to be scrolled. Hyperlinks and breaks may be indicated as in HTML.

Parameters:
text - the text to be scrolled
font - the font to use in displaying the text