Hi All,
I have a problem on retreiving the Label of selected ImageItem in J2ME.
Below one is my Code..
How can I Retreive the Selected Label of an ImageItem..
Thank You ...
I have a problem on retreiving the Label of selected ImageItem in J2ME.
Below one is my Code..
Code:
import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.AlertType; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.ImageItem; import javax.microedition.lcdui.Item; import javax.microedition.lcdui.ItemStateListener; import javax.microedition.midlet.*; public class homepage extends MIDlet { private Display disp; private Form form,form1; private Command cmd,cmd1; String[] str={"1","2","3"}; Image image,image1,image2; public homepage(){ disp=Display.getDisplay(this); form=new Form("Hai"); form1=new Form("Hello"); cmd=new Command("Exit", Command.EXIT , 1); cmd1=new Command("Ok",Command.SCREEN,2); form.addCommand(cmd); form.addCommand(cmd1); try{ image = Image.createImage("/xm-radio-mobile.jpg"); image1 = Image.createImage("/Drive-Backup-256x256.png"); image2 = Image.createImage("/exit.jpg"); [B] form.append(new ImageItem("Backup", image, ImageItem.LAYOUT_LEFT , null)); form.append(new ImageItem("Restore", image1, ImageItem.LAYOUT_CENTER, null)); form.append(new ImageItem("Quit", image2, ImageItem.LAYOUT_RIGHT, null));[/B] }catch (java.io.IOException e){ System.err.println(e); } form.setCommandListener(new CommandListener() { public void commandAction(Command c, Displayable d) { if(c==cmd){ destroyApp(false); notifyDestroyed(); } } }); } public void startApp() { disp.setCurrent(form); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }
Thank You ...
Comment