ImageItem.LAYOUT_CENTER : ImageItem « javax.microedition.lcdui « Java by API






ImageItem.LAYOUT_CENTER

    


import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.DateField;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Gauge;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.ImageItem;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;

public class Main extends MIDlet {
  Display d;

  Form aForm = new Form("Demo Form");

  ChoiceGroup aChoiceGroup = new ChoiceGroup("Choose", Choice.EXCLUSIVE, new String[] { "This",
      "That" }, null);

  DateField aDateField = new DateField(null, DateField.TIME);

  Gauge aGauge = new Gauge("Score", true, 10, 1);

  StringItem aStringItem = new StringItem(null, "Demo Items");

  TextField aTextField = new TextField("Comments", "Your comments here", 20, 0);

  ImageItem anImageItem;

  Image anImage;

  public Main() {
    try {
      anImage = Image.createImage("/star.png");
    } catch (java.io.IOException ioE) {
      System.out.println("Problem reading image");
    }
    anImageItem = new ImageItem("Demo Image", anImage, ImageItem.LAYOUT_CENTER, "No image");
    aForm.append(aStringItem);
    aForm.append(aChoiceGroup);
    aForm.append(aDateField);
    aForm.append(aGauge);
    aForm.append(aTextField);
    aForm.append(anImageItem);
  }

  protected void startApp() {
    d = Display.getDisplay(this);
    d.setCurrent(aForm);
  }

  protected void pauseApp() {
  }

  protected void destroyApp(boolean unconditional) {
  }
}

   
    
    
    
  








Related examples in the same category

1.ImageItem.LAYOUT_DEFAULT
2.ImageItem.LAYOUT_LEFT
3.ImageItem.LAYOUT_NEWLINE_AFTER
4.ImageItem.LAYOUT_NEWLINE_BEFORE
5.ImageItem.LAYOUT_RIGHT
6.new ImageItem(String label, Image img, int layout, String altText)