Sunday 22 January 2012


J2ME Program to Continuously Scroll a Data Message on the Mobile Screen

Code:
/*J2ME 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);
    }
  }}

Sample Output:

comment bellow for Query and Feedback :)

Related Posts :



0 comments:

Confused? Feel free to ask

Post a Comment