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.midlet.MIDlet;
public class ImageItemMIDlet extends MIDlet implements CommandListener {
private Command exitCommand = new Command("exit", Command.EXIT, 1);
private ImageItem imageItem;
private Image aImage;
private Display display = Display.getDisplay(this);
public ImageItemMIDlet() {
try {
aImage = Image.createImage("/10.png");
} catch (Exception e) {
}
imageItem = new ImageItem("Java 2", aImage, ImageItem.LAYOUT_CENTER, "image");
}
public void startApp() {
Form aForm = new Form("ImageItem");
aForm.append(imageItem);
aForm.addCommand(exitCommand);
aForm.setCommandListener(this);
display.setCurrent(aForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}
|