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.
-
CENTER
- Ease-of-use constant for bgDisplay parameter of setBackground method.
-
TILE
- Ease-of-use constant for bgDisplay parameter of setBackground method.
-
PhantomScroll()
-
-
getActiveLinkColor()
- Returns the active hyperlink color.
-
getAmplitude()
- Returns the amplitude of the oscillation.
-
getAppletInfo()
- Returns information about this applet.
-
getBackgroundColor()
- Returns the background color.
-
getBackgroundImage()
- Returns the background image.
-
getDelay()
- Returns the delay between frames/iterations.
-
getForegroundColor()
- Returns the foreground color.
-
getForegroundImage()
- Returns the foreground image.
-
getLinkColor()
- Returns the hyperlink color.
-
getParameterInfo()
- Returns information about the parameters that are understood by this applet.
-
getPeriod()
- Returns the period of the oscillation.
-
getSpeed()
- Returns the speed
-
getTarget()
- Returns the default target frame.
-
imageUpdate(Image, int, int, int, int, int)
- Repaints the component when the image has changed.
-
init()
- Initializes the applet.
-
mouseDown(Event, int, int)
- This method is called when the mouse button is pushed inside this component.
-
mouseDrag(Event, int, int)
- This method is called when the mouse button is moved inside this component with the button
pushed.
-
mouseEnter(Event, int, int)
- This method is called when the mouse first enters this component.
-
mouseExit(Event, int, int)
- This method is called when the mouse exits this component.
-
mouseMove(Event, int, int)
- This method is called when the mouse is moved inside this component with the mouse button
not pushed.
-
mouseUp(Event, int, int)
- This method is called when the mouse button is released inside this component.
-
paint(Graphics)
- Paints the component.
-
preferredSize()
- Determines the preferred size of the component.
-
resize(int, int)
- Resizes this component to the specified width and height.
-
run()
- Invoked when the scroller's internal thread is started through a call to the start
method.
-
setActiveLinkColor(Color)
- Sets the color of the hyperlink to which the mouse cursor is pointing
-
setAmplitude(int)
- Sets the amplitude of the oscillation.
-
setBackground(Color)
- Sets the background to a solid color.
-
setBackground(Image, Color, int)
- Sets the background image.
-
setDelay(int)
- Sets the frame rate.
-
setForeground(Color)
- Sets the foreground to a solid color.
-
setForeground(Image)
- Sets the foreground image pattern.
-
setLinkColor(Color)
- Sets the color of the hyperlinks.
-
setPeriod(int)
- Sets the period (inverse of frequency) of the oscillation.
-
setSpeed(int)
- Sets the speed of the scrolling motion
-
setTarget(String)
- Sets the default target frame.
-
setText(String, Font)
- Sets the text to be scrolled.
-
setText(URL, Font)
- Sets the text to be scrolled from a text file.
-
setTrail(double)
- Sets the fading trail effect.
-
start()
- Starts the scrolling animation.
-
stop()
- Stops the scrolling animation.
-
update(Graphics)
- Redraws the portion of the canvas that has been affected since the last animation frame.
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
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
PhantomScroll
public PhantomScroll()
getAppletInfo
public String getAppletInfo()
- Returns information about this applet.
- Returns:
- the information
- Overrides:
- getAppletInfo in class Applet
getParameterInfo
public String[][] getParameterInfo()
- Returns information about the parameters that are understood by this applet.
- Returns:
- the information
- Overrides:
- getParameterInfo in class Applet
init
public void init()
- Initializes the applet. This method loads and processes the parameters.
- Overrides:
- init in class Applet
start
public void start()
- Starts the scrolling animation.
- Overrides:
- start in class Applet
- See Also:
- stop
stop
public void stop()
- Stops the scrolling animation.
- Overrides:
- stop in class Applet
- See Also:
- start
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
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
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
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
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
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
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
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
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
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
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
preferredSize
public Dimension preferredSize()
- Determines the preferred size of the component.
- Returns:
- the preferred size of this component
- Overrides:
- preferredSize in class Container
getBackgroundColor
public Color getBackgroundColor()
- Returns the background color.
- Returns:
- the background color
getBackgroundImage
public Image getBackgroundImage()
- Returns the background image.
- Returns:
- the background image
getForegroundColor
public Color getForegroundColor()
- Returns the foreground color.
- Returns:
- the foreground color
getForegroundImage
public Image getForegroundImage()
- Returns the foreground image.
- Returns:
- the foreground image
getLinkColor
public Color getLinkColor()
- Returns the hyperlink color.
- Returns:
- the hyperlink color
getActiveLinkColor
public Color getActiveLinkColor()
- Returns the active hyperlink color.
- Returns:
- the active hyperlink color
getSpeed
public int getSpeed()
- Returns the speed
- Returns:
- the number of pixels to shift between frames/iterations
getDelay
public int getDelay()
- Returns the delay between frames/iterations.
- Returns:
- the delay in milliseconds
getAmplitude
public int getAmplitude()
- Returns the amplitude of the oscillation.
- Returns:
- the number of pixels by which to oscillate in either direction
getPeriod
public int getPeriod()
- Returns the period of the oscillation.
- Returns:
- the number of frames/iteration to complet an oscillation
getTarget
public String getTarget()
- Returns the default target frame.
- Returns:
- the name of default target frame
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
setBackground
public void setBackground(Color color)
- Sets the background to a solid color.
- Parameters:
- color - the background color
- Overrides:
- setBackground in class Component
setForeground
public void setForeground(Image image)
- Sets the foreground image pattern.
- Parameters:
- image - the foreground image
setForeground
public void setForeground(Color color)
- Sets the foreground to a solid color.
- Parameters:
- color - the foreground color
- Overrides:
- setForeground in class Component
setLinkColor
public void setLinkColor(Color color)
- Sets the color of the hyperlinks.
- Parameters:
- color - the hyperlink color
setActiveLinkColor
public void setActiveLinkColor(Color color)
- Sets the color of the hyperlink to which the mouse cursor is pointing
- Parameters:
- color - the hyperlink color
setSpeed
public void setSpeed(int speed)
- Sets the speed of the scrolling motion
- Parameters:
- speed - the number of pixels per animation frame
setDelay
public void setDelay(int delay)
- Sets the frame rate.
- Parameters:
- delay - the number of milliseconds between animation frames
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
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
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.
setTarget
public void setTarget(String target)
- Sets the default target frame.
- Parameters:
- target - the default target
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
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