10 Oct

Tutorial Java ME 2 – Part 4 Image Item

Contoh penggunaan ImageItem pada Form JavaME – J2ME

public class ImageItemDemo extends Form {

    public ImageItemDemo() {
        super("ImageItem Demo");
        try {
            Image img = Image.createImage("logo.png");
            
            ImageItem i1 = new ImageItem("Gambar", img, ImageItem.LAYOUT_CENTER, "");
            ImageItem i2 = new ImageItem("Gambar", img, ImageItem.LAYOUT_CENTER, "");
            
            append(i1);
            append(i2);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    
}