Skip to content

J2ME Ticker program

Aim: Write a Ticker program to continuously scroll a data message on the mobile screen.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TickerExample extends MIDlet implements CommandListener{
  private Display display;
  private Ticker ticker;
  private Command exit;
  private Form form;
    public TickerExample()
{
    form = new Form(“Ticker Example”);
    display = Display.getDisplay(this);
    ticker = new Ticker (“This is an Ticker Example”);
    exit = new Command(“Exit”, Command.SCREEN, 1);
    form.addCommand(exit);
    form.setCommandListener(this);
    form.setTicker(ticker);
  }
  public void startApp()
  {
    display.setCurrent(form);
  }
  public void pauseApp(){ }
  public void destroyApp(boolean unconditional)
  {
    notifyDestroyed();
  }
  public void commandAction(Command c, Displayable display)
    {
    String label = c.getLabel();
    if (label.equals(“Exit”)){
      destroyApp(false);
    }
  }}
Output:- 


Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!