javax.microedition.lcdui
Class Ticker

java.lang.Object
  |
  +--javax.microedition.lcdui.Ticker

public class Ticker
extends Object

Implements a "ticker-tape," a piece of text that runs continuously across the display. The direction and speed of scrolling are determined by the implementation. While animating, the ticker string scrolls continuously. That is, when the string finishes scrolling off the display, the ticker starts over at the beginning of the string.

There is no API provided for starting and stopping the ticker. The application model is that the ticker is always scrolling continuously. However, the implementation is allowed to pause the scrolling for power consumption purposes, for example, if the user doesn't interact with the device for a certain period of time. The implementation should resume scrolling the ticker when the user interacts with the device again.

The same ticker may be shared by several Screen objects. This can be accomplished by calling setTicker() on all such screens. Typical usage is for an application to place the same ticker on all of its screens. When the application switches between two screens that have the same ticker, a desirable effect is for the ticker to be displayed at the same location on the display and to continue scrolling its contents at the same position. This gives the illusion of the ticker being attached to the display instead of to each screen.

An alternative usage model is for the application to use different tickers on different sets of screens or even a different one on each screen. The ticker is an attribute of the Screen class so that applications may implement this model without having to update the ticker to be displayed as the user switches among screens.

Since:
MIDP 1.0

Constructor Summary
Ticker(String str)
          Constructs a new Ticker object, given its initial contents string.
 
Method Summary
 String getString()
          Gets the string currently being scrolled by the ticker.
 void setString(String str)
          Sets the string to be displayed by this ticker.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ticker

public Ticker(String str)
Constructs a new Ticker object, given its initial contents string.
Parameters:
str - string to be set for the Ticker
Throws:
NullPointerException - if str is null
Method Detail

getString

public String getString()
Gets the string currently being scrolled by the ticker.
Returns:
string of the ticker

setString

public void setString(String str)
Sets the string to be displayed by this ticker. If this ticker is active and is on the display, it immediately begins showing the new string.
Parameters:
str - string to be set for the Ticker
Throws:
NullPointerException - if str is null



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.