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.
-
context
- If used in an applet, this is the applet's context.
-
currIndex
- Index of current message text and URL
-
currLinkTo
- Current URL link.
-
currMessage
- Current message text.
-
frame
- Location in browser to show linked HTML pages.
-
hiliteColor
- Color for highlighted text.
-
isMouseOver
- Mouse over message text.
-
lastMouseX
- Last mouse cursor position.
-
lastMouseY
- Last mouse cursor position.
-
linkToList
- URL links which correspond with messages.
-
messageList
- List of messages to scroll across the banner.
-
SCROLL_LEFT
- Constant which indicates that the banner should scroll from right to left
-
SCROLL_RIGHT
- Constant which indicates that the banner should scroll from left to right
-
scrollDirection
- Current scroll direction.
-
scrollThread
- Thread which runs the scrolling animation.
-
scrollUnit
- Distance to scroll on each update.
-
sleepTime
- Controls the speed of the scroll.
-
suspended
- State of scrolling animation.
-
textHeight
- Height of current message text.
-
textWidth
- Width of current message text.
-
textX
- Current horizontal text position.
-
textY
- Current vertical text position.
-
wasMouseOverText
- Status of mouse position.
-
wasStatusMessage
- Previous status message.
-
ScrollingText()
- Construct default scrolling text banner.
-
addNotify()
- Tells this component that it has been added to a container.
-
createTextParams()
- Setup metrics information for current message.
-
getFrame()
- Obtain the display location of linked pages.
-
getHiliteColor()
- Obtain the current color for text highlighting
-
getLinkToList()
- Obtain the current set of URL links.
-
getMessageList()
- Obtain the current list of messages.
-
getScrollDirection()
- Obtain the current direction of scrolling.
-
getScrollInterval()
- Obtain the current scroll interval.
-
getScrollUnit()
- Obtain the current size of the scroll step.
-
hide()
- Makes this component invisible.
-
isMouseOverText(int, int)
- Determines if the given point is over the current text.
-
mouseDown(Event, int, int)
- Processes MOUSE_DOWN events.
-
mouseExit(Event, int, int)
- Processes MOUSE_EXIT events.
-
mouseMove(Event, int, int)
- Processes MOUSE_MOVE events.
-
nextPos()
- Increment scroll step.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
removeNotify()
- Tells this component that it is being removed from a container.
-
reshape(int, int, int, int)
- Moves and/or resizes this component.
-
run()
- ScrollingText thread body.
-
setAppletContext(AppletContext)
- Specify the current applet context.
-
setFrame(String)
- Specify the display location of linked pages.
-
setHiliteColor(Color)
- Set the highlight color for text.
-
setLinkToList(URL[])
- Specify the list of URLs for message links.
-
setMessageList(String[])
- Specify the current list of messages.
-
setScrollDirection(int)
- Specify the banner's current scroll direction.
-
setScrollInterval(int)
- Set sleep time between scroll steps.
-
setScrollUnit(int)
- Specify the size of each scroll step.
-
show()
- Makes this component visible.
-
startScrollingText()
- Resumes the animation of the scrolling text.
-
stopScrollingText()
- Suspends the animation of the scrolling text.
-
update(Graphics)
- Handles redrawing of this component on the screen.
-
updateCurrentMessage(boolean)
- Move to next message in message list.
-
validate()
- Ensures that this component is laid out properly, as needed.
SCROLL_LEFT
public final static int SCROLL_LEFT
- Constant which indicates that the banner should scroll from right to left
SCROLL_RIGHT
public final static int SCROLL_RIGHT
- Constant which indicates that the banner should scroll from left to right
scrollDirection
protected int scrollDirection
- Current scroll direction. Default value SCROLL_LEFT.
scrollUnit
protected int scrollUnit
- Distance to scroll on each update. Distance is in pixels. Default value 10.
sleepTime
protected int sleepTime
- Controls the speed of the scroll. Default value 150.
hiliteColor
protected Color hiliteColor
- Color for highlighted text. Default value is red.
messageList
protected String messageList[]
- List of messages to scroll across the banner.
linkToList
protected URL linkToList[]
- URL links which correspond with messages.
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.
context
protected AppletContext context
- If used in an applet, this is the applet's context.
scrollThread
protected Thread scrollThread
- Thread which runs the scrolling animation.
suspended
protected boolean suspended
- State of scrolling animation.
textX
protected int textX
- Current horizontal text position.
textY
protected int textY
- Current vertical text position.
textWidth
protected int textWidth
- Width of current message text.
textHeight
protected int textHeight
- Height of current message text.
isMouseOver
protected boolean isMouseOver
- Mouse over message text.
lastMouseX
protected int lastMouseX
- Last mouse cursor position.
lastMouseY
protected int lastMouseY
- Last mouse cursor position.
wasMouseOverText
protected boolean wasMouseOverText
- Status of mouse position.
wasStatusMessage
protected String wasStatusMessage
- Previous status message.
currMessage
protected String currMessage
- Current message text.
currLinkTo
protected URL currLinkTo
- Current URL link.
currIndex
protected int currIndex
- Index of current message text and URL
ScrollingText
public ScrollingText()
- Construct default scrolling text banner.
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.
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
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
getScrollUnit
public int getScrollUnit()
- Obtain the current size of the scroll step.
- Returns:
- the number of pixels that text moves on each scroll step
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
getScrollDirection
public int getScrollDirection()
- Obtain the current direction of scrolling.
- Returns:
- the current direction, either SCROLL_LEFT or SCROLL_RIGHT
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.
getHiliteColor
public Color getHiliteColor()
- Obtain the current color for text highlighting
- Returns:
- current highlight color
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
getMessageList
public String[] getMessageList()
- Obtain the current list of messages.
- Returns:
- the current list of messages being displayed
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
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
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
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
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
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
startScrollingText
public void startScrollingText()
- Resumes the animation of the scrolling text.
stopScrollingText
public void stopScrollingText()
- Suspends the animation of the scrolling text.
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
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
run
public void run()
- ScrollingText thread body. This method is called by the Java virtual
machine to when this thread starts.
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
nextPos
public synchronized void nextPos()
- Increment scroll step. Moves to next message as needed. Not usually called directly.
createTextParams
protected void createTextParams()
- Setup metrics information for current message. Sets textX, textY, textHeight and textWidth.
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
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
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
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
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
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
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
setAppletContext
protected void setAppletContext(AppletContext c)
- Specify the current applet context.
- Parameters:
- c - new applet context
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