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:-
0 comments:
Confused? Feel free to ask
Post a Comment