Java Tutorial/J2ME/Ticker
Use Ticker
import javax.microedition.lcdui.rumand;
import javax.microedition.lcdui.rumandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.Ticker;
import javax.microedition.midlet.MIDlet;
public class J2MEappendTicker extends MIDlet implements CommandListener {
private Command exitCommand = new Command("cmd", Command.EXIT, 1);
private Display display;
public J2MEappendTicker() {
display = Display.getDisplay(this);
}
public void startApp() {
TextBox t = new TextBox("Hello", "Welcome to MIDP Programming", 256, 0);
Ticker aTicker = new Ticker("ticker");
t.setTicker(aTicker);
t.addCommand(exitCommand);
t.setCommandListener(this);
display.setCurrent(t);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}