import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class TickerList extends MIDlet implements CommandListener
{
private Display d;
private List list;
private final String tech;
private final String movies;
private Ticker t;
private Command exit;
private Command submit;
public TickerList()
{
d=Display.getDisplay(this);
tech=new String("c c++ java sap android");
movies=new String("jalsa athadu chennai express");
exit=new Command("Exit", Command.SCREEN,1);
submit=new Command("Submit", Command.SCREEN,1);
t=new Ticker(tech);
list=new List("News", Choice.EXCLUSIVE);
list.append("Technology",null);
list.append("Movies",null);
list.addCommand(exit);
list.addCommand(submit);
list.setCommandListener(this);
list.setTicker(t);
}
public void startApp()
{
d.setCurrent(list);
}
public void pauseApp()
{
}
public void destroyApp(boolean b)
{
}
public void commandAction(Command c,Displayable dd)
{
if(c==exit)
{
destroyApp(true);
notifyDestroyed();
}
else if(c==submit)
{
if(list.getSelectedIndex()==0)
{
t.setString(tech);
}
else
{
t.setString(movies);
}
}
}
}
No comments:
Post a Comment