TextBox: setTicker(Ticker ticker) : TextBox « javax.microedition.lcdui « Java by API






TextBox: setTicker(Ticker ticker)

 


import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
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();
    }
  }
}

   
  








Related examples in the same category

1.new TextBox(String title, String text, int maxSize, int constraints)
2.TextBox: addCommand(Command cmd)
3.TextBox: setCommandListener(CommandListener l)