简体   繁体   English

当我尝试用J2ME加载图像时,为什么我的图层不出现?

[英]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: 这些是我得到的错误:

TRACE: , startApp threw an Exception 跟踪:,startApp引发了异常
java.lang.IllegalArgumentException java.lang.IllegalArgumentException

at javax.microedition.lcdui.game.TiledLayer.(), bci=66 在javax.microedition.lcdui.game.TiledLayer。(),bci = 66
at RRCanvas.start(RRCanvas.java:32) 在RRCanvas.start(RRCanvas.java:32)
at RRashlMIDlet.startApp(RRashlMIDlet.java:16) 在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. 在TiledLayer构造函数中引发了异常。 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. 看一下可能引发该异常的可能原因,并使用调试器找出任何构造函数调用的参数是否存在这些问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM