Form with an Image Item

Description:

The following code creates a Form with an Image Item.

import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Image_Item extends MIDlet
{
    Display display=Display.getDisplay(this);
    public void startApp()
    {
        Form form = new Form("Form example");
        try
        {
            Image Logo = Image.createImage("/images/logo.png");
            //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);
        }
       display.setCurrent(form);
    }
}

Download:

FormWithImageItem.java

Output:

The following screenshots are the outcome. Just click on the icon to enlarge it for a better view.

Department of Electronic Systems | Aalborg University | Niels Jernes Vej 12 | DK-9220 Aalborg | Denmark
Phone: (+45) 9635 8695 | Fax (+45) 9815 1583 | E-mail ies(at)ies.aau.dk
Copyright © 2006 Department of Electronic Systems

Last update:11-10-2006