J2ME MIDlet Problem

Discussion in 'Java' started by Bob Rivers, Jan 10, 2004.

  1. Bob Rivers

    Bob Rivers Guest

    Hi,

    I'm new to J2ME and I am trying to build a simple test. I want to plot
    some dots on my Motorola A388 screen.

    I did the code bellow, and it works well. The problem is when I try to
    use a FOR loop in order to plot several dots.

    If I download and install it into the cell phone, I got an error:
    A388-E1008: The downloaded J2ME applications cannot be installed.

    If I use the Motorola SDK 4.0 and try to install it into the emulator,
    I receive the following error message (into the console): Fatal Error:
    Verification failed com/innovaction/dots/Dots::<init>@8

    If I remove the loop, it works well.

    Any clues?

    TIA,

    Bob

    package com.innovaction.dots;

    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;

    public class Dots extends MIDlet {

    private Display display;
    private DotsCanvas canvas;

    Dots() {
    canvas = new DotsCanvas();
    display = Display.getDisplay(this);
    }

    class DotsCanvas extends Canvas {
    Font font = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN,
    Font.SIZE_SMALL);

    public void paint(Graphics g) {
    g.setFont(font);
    g.setColor(0);

    int altura = canvas.getHeight();
    int largura = canvas.getWidth();

    System.out.println(">>>>>>>>>> ALTURA ORIGINAL : " + altura);
    System.out.println(">>>>>>>>>> LARGURA ORIGINAL : " + largura);

    altura = altura - (altura / 3);
    largura = largura - (largura / 3);

    System.out.println(">>>>>>>>>> ALTURA REDUZIDA : " + altura);
    System.out.println(">>>>>>>>>> LARGURA REDUZIDA : " + largura);


    int yInicial = (canvas.getHeight() - altura)/2;
    int xInicial = (canvas.getWidth() - largura)/2;

    System.out.println(">>>>>>>>>> yInicial : " + yInicial);
    System.out.println(">>>>>>>>>> xInicial : " + xInicial);

    g.drawString(".", xInicial, yInicial, 0);

    for (int i = 0; i < 200; i++) {
    System.out.println(">>> i : " + i);
    }

    g.drawLine(10, 20, 50, 20);
    }

    }

    public void startApp() throws MIDletStateChangeException {
    display.setCurrent(canvas);
    }

    public void pauseApp() {

    }

    public void destroyApp(boolean unconditional) {

    }
    }
    Bob Rivers, Jan 10, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. boki
    Replies:
    2
    Views:
    670
  2. Roy
    Replies:
    2
    Views:
    619
  3. Replies:
    4
    Views:
    4,640
  4. Replies:
    0
    Views:
    597
  5. Jeff
    Replies:
    3
    Views:
    4,798
    Darryl L. Pierce
    Oct 12, 2005
Loading...

Share This Page