Retreive the Label Selected ImageItem in J2ME | Member | | Join Date: Aug 2008
Posts: 48
| |
Hi All,
I have a problem on retreiving the Label of selected ImageItem in J2ME.
Below one is my 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");
- 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)); }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) {
-
}
-
}
-
How can I Retreive the Selected Label of an ImageItem..
Thank You ...
| | Member | | Join Date: Aug 2008
Posts: 48
| | | re: Retreive the Label Selected ImageItem in J2ME
Hi All,
I have a problem on retreiving the Label of selected ImageItem in J2ME.
Below one is my 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");
- 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)); }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) {
-
}
-
}
-
How can I Retreive the Selected Label of an ImageItem..
Thank You ...
|  | Site Moderator | | Join Date: Jan 2007 Location: America
Posts: 3,393
| | | re: Retreive the Label Selected ImageItem in J2ME
I've merged your posts, please do not double post.
|  | Similar Mobile Development bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|