All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.multimedia.ScrollingText

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----symantec.itools.multimedia.ScrollingText

public class ScrollingText
extends Canvas
implements Runnable
Scrolling text component. Forms a text banner that scrolls specified text horizontally. The component allows multiple messages and links.


Variable Index

 o context
If used in an applet, this is the applet's context.
 o currIndex
Index of current message text and URL
 o currLinkTo
Current URL link.
 o currMessage
Current message text.
 o frame
Location in browser to show linked HTML pages.
 o hiliteColor
Color for highlighted text.
 o isMouseOver
Mouse over message text.
 o lastMouseX
Last mouse cursor position.
 o lastMouseY
Last mouse cursor position.
 o linkToList
URL links which correspond with messages.
 o messageList
List of messages to scroll across the banner.
 o SCROLL_LEFT
Constant which indicates that the banner should scroll from right to left
 o SCROLL_RIGHT
Constant which indicates that the banner should scroll from left to right
 o scrollDirection
Current scroll direction.
 o scrollThread
Thread which runs the scrolling animation.
 o scrollUnit
Distance to scroll on each update.
 o sleepTime
Controls the speed of the scroll.
 o suspended
State of scrolling animation.
 o textHeight
Height of current message text.
 o textWidth
Width of current message text.
 o textX
Current horizontal text position.
 o textY
Current vertical text position.
 o wasMouseOverText
Status of mouse position.
 o wasStatusMessage
Previous status message.

Constructor Index

 o ScrollingText()
Construct default scrolling text banner.

Method Index

 o addNotify()
Tells this component that it has been added to a container.
 o createTextParams()
Setup metrics information for current message.
 o getFrame()
Obtain the display location of linked pages.
 o getHiliteColor()
Obtain the current color for text highlighting
 o getLinkToList()
Obtain the current set of URL links.
 o getMessageList()
Obtain the current list of messages.
 o getScrollDirection()
Obtain the current direction of scrolling.
 o getScrollInterval()
Obtain the current scroll interval.
 o getScrollUnit()
Obtain the current size of the scroll step.
 o hide()
Makes this component invisible.
 o isMouseOverText(int, int)
Determines if the given point is over the current text.
 o mouseDown(Event, int, int)
Processes MOUSE_DOWN events.
 o mouseExit(Event, int, int)
Processes MOUSE_EXIT events.
 o mouseMove(Event, int, int)
Processes MOUSE_MOVE events.
 o nextPos()
Increment scroll step.
 o paint(Graphics)
Paints this component using the given graphics context.
 o removeNotify()
Tells this component that it is being removed from a container.
 o reshape(int, int, int, int)
Moves and/or resizes this component.
 o run()
ScrollingText thread body.
 o setAppletContext(AppletContext)
Specify the current applet context.
 o setFrame(String)
Specify the display location of linked pages.
 o setHiliteColor(Color)
Set the highlight color for text.
 o setLinkToList(URL[])
Specify the list of URLs for message links.
 o setMessageList(String[])
Specify the current list of messages.
 o setScrollDirection(int)
Specify the banner's current scroll direction.
 o setScrollInterval(int)
Set sleep time between scroll steps.
 o setScrollUnit(int)
Specify the size of each scroll step.
 o show()
Makes this component visible.
 o startScrollingText()
Resumes the animation of the scrolling text.
 o stopScrollingText()
Suspends the animation of the scrolling text.
 o update(Graphics)
Handles redrawing of this component on the screen.
 o updateCurrentMessage(boolean)
Move to next message in message list.
 o validate()
Ensures that this component is laid out properly, as needed.

Variables

 o SCROLL_LEFT
  public final static int SCROLL_LEFT
Constant which indicates that the banner should scroll from right to left

 o SCROLL_RIGHT
  public final static int SCROLL_RIGHT
Constant which indicates that the banner should scroll from left to right

 o scrollDirection
  protected int scrollDirection
Current scroll direction. Default value SCROLL_LEFT.

 o scrollUnit
  protected int scrollUnit
Distance to scroll on each update. Distance is in pixels. Default value 10.

 o sleepTime
  protected int sleepTime
Controls the speed of the scroll. Default value 150.

 o hiliteColor
  protected Color hiliteColor
Color for highlighted text. Default value is red.

 o messageList
  protected String messageList[]
List of messages to scroll across the banner.

 o linkToList
  protected URL linkToList[]
URL links which correspond with messages.

 o frame
  protected String frame
Location in browser to show linked HTML pages. Valid values are "_self" to show in the current frame; "_parent" show in the parent frame; "_top" show in the topmost frame; "_blank" show in a new unnamed top-level window; name show in a new top-level window named name.

 o context
  protected AppletContext context
If used in an applet, this is the applet's context.

 o scrollThread
  protected Thread scrollThread
Thread which runs the scrolling animation.

 o suspended
  protected boolean suspended
State of scrolling animation.

 o textX
  protected int textX
Current horizontal text position.

 o textY
  protected int textY
Current vertical text position.

 o textWidth
  protected int textWidth
Width of current message text.

 o textHeight
  protected int textHeight
Height of current message text.

 o isMouseOver
  protected boolean isMouseOver
Mouse over message text.

 o lastMouseX
  protected int lastMouseX
Last mouse cursor position.

 o lastMouseY
  protected int lastMouseY
Last mouse cursor position.

 o wasMouseOverText
  protected boolean wasMouseOverText
Status of mouse position.

 o wasStatusMessage
  protected String wasStatusMessage
Previous status message.

 o currMessage
  protected String currMessage
Current message text.

 o currLinkTo
  protected URL currLinkTo
Current URL link.

 o currIndex
  protected int currIndex
Index of current message text and URL

Constructors

 o ScrollingText
  public ScrollingText()
Construct default scrolling text banner.

Methods

 o setScrollInterval
  public void setScrollInterval(int speed)
Set sleep time between scroll steps. This function controls the speed of scrolling. A lower number indicates a faster speed.

Parameters:
speed - number of milliseconds to sleep between scroll steps. The smaller the number the faster the scroll. Minimum value of 30.
 o getScrollInterval
  public int getScrollInterval()
Obtain the current scroll interval. This is the number of milliseconds that the scroll thread will sleep between scroll steps.

Returns:
current scroll delay setting, in milliseconds
 o setScrollUnit
  public void setScrollUnit(int unit)
Specify the size of each scroll step.

Parameters:
unit - the number of pixels to move the text on each scroll step
 o getScrollUnit
  public int getScrollUnit()
Obtain the current size of the scroll step.

Returns:
the number of pixels that text moves on each scroll step
 o setScrollDirection
  public void setScrollDirection(int dir)
Specify the banner's current scroll direction.

Parameters:
dir - direction to scroll. Valid values are SCROLL_LEFT and SCROLL_RIGHT
 o getScrollDirection
  public int getScrollDirection()
Obtain the current direction of scrolling.

Returns:
the current direction, either SCROLL_LEFT or SCROLL_RIGHT
 o setHiliteColor
  public void setHiliteColor(Color newHiliteColor)
Set the highlight color for text. Text is highlighted in this color when the mouse cursor is over it and it contains a non-null link.

Parameters:
newHiliteColor - color for highlighted text.
 o getHiliteColor
  public Color getHiliteColor()
Obtain the current color for text highlighting

Returns:
current highlight color
 o setMessageList
  public void setMessageList(String list[])
Specify the current list of messages. These messages scroll sequentially through the banner.

Parameters:
list - list of messages to display
 o getMessageList
  public String[] getMessageList()
Obtain the current list of messages.

Returns:
the current list of messages being displayed
 o setLinkToList
  public void setLinkToList(URL list[])
Specify the list of URLs for message links. Each link corresponds with a message in the message list. If a message has no link, a null URL should be included for that message.

Parameters:
list - list of URL links
 o getLinkToList
  public URL[] getLinkToList()
Obtain the current set of URL links.

Returns:
list of URL links. Each URL corresponds to the message of the same index in the message list
 o setFrame
  public void setFrame(String f)
Specify the display location of linked pages. If the ScrollingText is in an applet this method determines where the linked pages are displayed.

Parameters:
f - where to display the linked documents. Valid values are "_self" to show in the current frame; "_parent" show in the parent frame; "_top" show in the topmost frame; "_blank" show in a new unnamed top-level window; show in a new top-level window named name
 o getFrame
  public String getFrame()
Obtain the display location of linked pages. If the ScrollingText is in an applet this method returns where the linked pages are displayed.

Returns:
Place to display the linked documents. Valid values are "_self" to show in the current frame; "_parent" show in the parent frame; "_top" show in the topmost frame; "_blank" show in a new unnamed top-level window; show in a new top-level window named name
 o addNotify
  public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to start the scrolling text thread.

Overrides:
addNotify in class Canvas
See Also:
removeNotify
 o removeNotify
  public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to stop the scrolling text thread.

Overrides:
removeNotify in class Component
See Also:
addNotify
 o startScrollingText
  public void startScrollingText()
Resumes the animation of the scrolling text.

 o stopScrollingText
  public void stopScrollingText()
Suspends the animation of the scrolling text.

 o show
  public synchronized void show()
Makes this component visible. This is a standard Java AWT method which gets called to show this component. If this component was invisible due to a previous hide() call it make this component visible again.

Overrides:
show in class Component
See Also:
hide
 o hide
  public synchronized void hide()
Makes this component invisible. This is a standard Java AWT method which gets called to hide this component. A hidden component cannot be seen by the user nor does it take up space in its container, but it does continue to exist.

Overrides:
hide in class Component
See Also:
show
 o run
  public void run()
ScrollingText thread body. This method is called by the Java virtual machine to when this thread starts.

 o updateCurrentMessage
  public void updateCurrentMessage(boolean next)
Move to next message in message list. Not usually called directly.

Parameters:
next - if true, move to next message; otherwise reset message with current index
 o nextPos
  public synchronized void nextPos()
Increment scroll step. Moves to next message as needed. Not usually called directly.

 o createTextParams
  protected void createTextParams()
Setup metrics information for current message. Sets textX, textY, textHeight and textWidth.

 o update
  public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to reduce flicker by eliminating the uneeded clearing of the background.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o isMouseOverText
  protected boolean isMouseOverText(int x,
                                    int y)
Determines if the given point is over the current text.

Parameters:
x - horizontal location of point
y - vertical location of point
Returns:
true if given point is over the current text
 o paint
  public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o mouseMove
  public boolean mouseMove(Event evt,
                           int x,
                           int y)
Processes MOUSE_MOVE events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_MOVE event. These events occur when the mouse is moved around inside this component while the button is NOT pressed.

Parameters:
evt - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseMove in class Component
See Also:
mouseDrag, handleEvent
 o mouseExit
  public boolean mouseExit(Event evt,
                           int x,
                           int y)
Processes MOUSE_EXIT events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_EXIT event. These events occur when the mouse first leaves this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseExit in class Component
See Also:
mouseEnter, handleEvent
 o mouseDown
  public boolean mouseDown(Event evt,
                           int x,
                           int y)
Processes MOUSE_DOWN events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_DOWN event. These events occur when the mouse button is pressed while inside this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseDown in class Component
See Also:
mouseUp, handleEvent
 o validate
  public void validate()
Ensures that this component is laid out properly, as needed. This is a standard Java AWT method which gets called by the AWT to make sure this component and its subcomponents have a valid layout. If this component was made invalid with a call to invalidate(), then it is laid out again. It is overridden here to also find the containing applet at validation time.

Overrides:
validate in class Component
See Also:
invalidate
 o setAppletContext
  protected void setAppletContext(AppletContext c)
Specify the current applet context.

Parameters:
c - new applet context
 o reshape
  public synchronized void reshape(int x,
                                   int y,
                                   int width,
                                   int height)
Moves and/or resizes this component. This is a standard Java AWT method which gets called to move and/or resize this component. Components that are in containers with layout managers should not call this method, but rely on the layout manager instead.

Parameters:
x - horizontal position in the parent's coordinate space
y - vertical position in the parent's coordinate space
width - the new width
height - the new height
Overrides:
reshape in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index