J2ME MIDlet Problem

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

  1. Bob Rivers

    Bob Rivers Guest


    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?



    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,

    public void paint(Graphics g) {

    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 {

    public void pauseApp() {


    public void destroyApp(boolean unconditional) {

    Bob Rivers, Jan 10, 2004
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.