开发者

Why won't my layers appear when I try to load an image with J2ME?

I'm trying to load an image. The program compiles but the layers don't appear.

These are the errors I get:

开发者_JAVA技巧

TRACE: , startApp threw an Exception

java.lang.IllegalArgumentException

at javax.microedition.lcdui.game.TiledLayer.(), bci=66

at RRCanvas.start(RRCanvas.java:32)

at RRashlMIDlet.startApp(RRashlMIDlet.java:16)

and this is the code on those lines:

try {
        trackLayer = new TiledLayer(12, 48, Image.createImage("/map.png"), 48, 48);
        grassLayer = new TiledLayer(12, 48, Image.createImage("/map.png"), 48, 48);
        checkpointLayer = new TiledLayer(12 , 48, Image.createImage("/map.png"), 48, 48);
    }
        catch (IOException e) {
      System.err.println("Failed loading images!");
    }

and

canvas.start();


The exception is being thrown in the TiledLayer constructor. Here is the documentation for that constructor. Have a look at the possible reasons why that exception might be thrown, and use the debugger to find out if the arguments to any of the constructor calls have those problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜