ImageItem
is used to display an image on a Form
. ImageItem
s
can be used as links or buttons to help the user navigate the MIDlet. If an
image cannot fit to the width of the screen, it is drawn starting from the
top left corner and excess is dropped. Each ImageItem
object
contains a reference to an Image
object.
Source code for the example:
import java.io.IOException; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class ExampleForm3 extends MIDlet implements CommandListener { public void startApp() { Form form = new Form("Form example 3"); try { Image Logo = Image.createImage("/form/res/java.jpg"); //ImageItem(label,Image,layout,alternative text) ImageItem imageitem = new ImageItem("ImageItem Example", Logo, ImageItem.LAYOUT_CENTER,""); form.append(imageitem); } catch (IOException ex) { System.out.println("Exception occurred: "+ex); } exit = new Command("Exit", Command.EXIT, 1); form.addCommand(exit); form.setCommandListener(this); Display display = Display.getDisplay(this); display.setCurrent(form); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command command, Displayable displayable) { if (command == exit) { destroyApp(false); notifyDestroyed(); } } }
For more information about S60-specific Gauge
features,
see ImageItem implementation
notes.