Discussion Board

Results 1 to 2 of 2

Thread: Image

  1. #1
    Registered User
    Join Date
    Jul 2004


    How an image is inserted in a mobile by using J2me appln?

  2. #2
    Registered User
    Join Date
    Jun 2004

    i am new to j2me too, but i managed showing an image like this:

    Image franz=null, ko=null;
    boolean error=false;
    try {
    franz = Image.createImage("../icons/Franz.png");
    ko = Image.createImage("../icons/KO.png");
    } catch (Exception e) {
    error = true;
    System.out.println("Fehler beim Anlegen der Bilder");

    * erzeugt einen Bildeintrag
    * (label, das Bild, layout, der alternative Text, die Darstellungsart)
    ImageItem ii=null, ii2=null;
    if (!error) ii = new ImageItem("Bild", ko, Item.LAYOUT_LEFT, "alternativer Text", ImageItem.PLAIN);
    if (!error) ii2 = new ImageItem("Bild2", franz, Item.LAYOUT_RIGHT, "alternativer Text", ImageItem.PLAIN);

    if (ii!=null) form.append(ii);
    if (ii2!=null) form.append(ii2);


    As u can see, i use two pics. these images must be in the res folder of your project (in this case: res\icons\Franz.png, ...)

    I am using a form on which i place my images in an imageitem. In case anything goes wrong i managed not to add these items (as this would result in an error)

    hope i could help

    gr Franz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts