All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.set.TickerTape

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----tea.set.TickerTape

public class TickerTape
extends Canvas
implements Runnable
TickerTape provides an interface similar to a stock ticker tape. It can display a text stream in one strip by moving the text from right to left. If multiple row of display is used, TickerTape use a typewriter style display, by scrolling lines, and drawing each new line of text one character at a time. It scrolls up one line when a newline is seen, or a line has been filled up.

Tickertape can also operates in a line scroll mode. In this mode, instead of scrolling by characters, everytime a complete line is scrolled off the screen upward. There is no difference between single line or multiple line modes. The text is broken up into lines using newline character '\n'. TickerTape is in character scroll mode by default.

TickerTape supports the following properties:
Property NameProperty TypeDescription
Widthint (Writeonly) The character width of the ticker tape.
MessageURL/String Ticker tape text message.


Variable Index

 o CHAR_SCROLL
Scroll by character.
 o LINE_SCROLL
Scroll by line.

Constructor Index

 o TickerTape()
Construct an empty TickerTape.
 o TickerTape(String)
Construct a TickerTape with message as the text for displaying.
 o TickerTape(String, int)
Construct a TickerTape with message as the text for displaying.
 o TickerTape(String, int, int)
Construct a TickerTape with message as the text for displaying.
 o TickerTape(URL)
Construct a TickerTape and display the content of url.
 o TickerTape(URL, int)
Construct a TickerTape and display the content of url.
 o TickerTape(URL, int, int)
Construct a TickerTape and display the content of url.

Method Index

 o adjustSpeed(int)
Adjust the ticker tape speed.
 o getMinimumSize()
Return the minimum size of TickerTape.
 o getPreferredSize()
Return the preferred size of TickerTape.
 o paint(Graphics)
Paint TickerTape.
 o reload()
A call to this function will cause that the TickerTape to reload text from the URL.
 o run()
TickerTape main loop.
 o setMessage(String)
Set the message for displaying.
 o setMessage(URL)
Set the URL content for displaying.
 o setWidth(int)
Set the preferred width of this component.
 o start()
Create a new thread and start the TickerTape main loop, or resume a suspended main loop thread.
 o start(ActionEvent)
Action handler for start action.
 o stop()
Stop the TickerTape thread.
 o stop(ActionEvent)
Action handler for stop action.
 o update(Graphics)
Don't clear area, for double buffering.

Variables

 o CHAR_SCROLL
 public static final int CHAR_SCROLL
Scroll by character. If TickerTape is in single line mode, the ticker will be a single line moving from right to left. If it's in multi-line mode, the interface is similar to a typewriter, with one character appended to the last line every iteration.

 o LINE_SCROLL
 public static final int LINE_SCROLL
Scroll by line. In this mode, one line is scrolled upwards every iteration. The delay between lines depends on the length of the topmost line.

Constructors

 o TickerTape
 public TickerTape()
Construct an empty TickerTape.

 o TickerTape
 public TickerTape(String message)
Construct a TickerTape with message as the text for displaying.

Parameters:
message - ticker message.
 o TickerTape
 public TickerTape(URL url)
Construct a TickerTape and display the content of url.

Parameters:
url - ticker content URL.
 o TickerTape
 public TickerTape(String message,
                   int rows)
Construct a TickerTape with message as the text for displaying. If rows equals one, TickerTape displays one line scrolling text. Otherwise, it displays multiple lines with typewriter style display.

Parameters:
message - ticker message.
rows - number of display rows of text.
 o TickerTape
 public TickerTape(URL url,
                   int rows)
Construct a TickerTape and display the content of url. If rows equals one, TickerTape displays one line scrolling text. Otherwise, it displays multiple lines with typewriter style display.

Parameters:
url - ticker content URL.
rows - number of display rows of text.
 o TickerTape
 public TickerTape(String message,
                   int rows,
                   int mode)
Construct a TickerTape with message as the text for displaying. If rows equals one, TickerTape displays one line scrolling text. Otherwise, it displays multiple lines with typewriter style display. Either CHAR_SCROLL or LINE_SCROLL mode can be specified.

Parameters:
message - ticker message.
rows - number of display rows of text.
mode - line or character mode.
 o TickerTape
 public TickerTape(URL url,
                   int rows,
                   int mode)
Construct a TickerTape and display the content of url. If rows equals one, TickerTape displays one line scrolling text. Otherwise, it displays multiple lines with typewriter style display. Either CHAR_SCROLL or LINE_SCROLL mode can be specified.

Parameters:
url - ticker content URL.
rows - number of display rows of text.
mode - line or character mode.

Methods

 o setWidth
 public synchronized void setWidth(int cols)
Set the preferred width of this component. The width is the number of characters.

Parameters:
cols - number of characters.
 o setMessage
 public synchronized void setMessage(String message)
Set the message for displaying.

Parameters:
message - ticker message.
 o setMessage
 public synchronized void setMessage(URL url)
Set the URL content for displaying.

Parameters:
url - ticker content URL.
 o run
 public void run()
TickerTape main loop. It never returns.

 o reload
 public synchronized void reload()
A call to this function will cause that the TickerTape to reload text from the URL. This allows other applets to update information being desplayed on a TickerTape.

 o start
 public void start()
Create a new thread and start the TickerTape main loop, or resume a suspended main loop thread.

 o stop
 public void stop()
Stop the TickerTape thread.

 o adjustSpeed
 public synchronized void adjustSpeed(int inc)
Adjust the ticker tape speed. Positive argument makes the text move faster, and negative argument makes the text move slower.

Parameters:
inc - speed adjustment.
 o getMinimumSize
 public Dimension getMinimumSize()
Return the minimum size of TickerTape.

Returns:
minimum size.
Overrides:
getMinimumSize in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Return the preferred size of TickerTape.

Returns:
preferred size.
Overrides:
getPreferredSize in class Component
 o paint
 public void paint(Graphics g)
Paint TickerTape.

Parameters:
g - Graphics context of this component.
Overrides:
paint in class Canvas
 o update
 public void update(Graphics g)
Don't clear area, for double buffering.

Parameters:
g - Graphics context of this component.
Overrides:
update in class Component
 o start
 public void start(ActionEvent e)
Action handler for start action.

 o stop
 public void stop(ActionEvent e)
Action handler for stop action.


All Packages  Class Hierarchy  This Package  Previous  Next  Index