/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author selvakumar
*/
public class item_demo extends MIDlet implements ItemCommandListener{
Display display;
Form form;
Form mainform;
Command back;
Command cmd;
Command click;
ImageItem it;
Image img;
public item_demo()
{
form=new Form("hello") ;
mainform=new Form("form2");
cmd=new Command("simply",Command.OK,1);
click=new Command("click",Command.OK,1);
back=new Command("BACK",Command.OK,1);
form.addCommand(click);
mainform.addCommand(back);
try{
img=Image.createImage("untitled.png");
it=new ImageItem(null,img,ImageItem.LAYOUT_CENTER,null,ImageItem.PLAIN);
form.append(it);
it.setDefaultCommand(cmd);
it.setItemCommandListener(this);
}
catch(Exception e)
{
}
}
public void startApp() {
display=Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Item d)
{
if(c==cmd)
{
display.setCurrent(mainform);
mainform.append("gud morg");
}
else if(c==back)
{
display.setCurrent(form);
}
}
}

Reply With Quote


