Reputation: 1
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
java.lang.IllegalArgumentExceptionat 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();
Upvotes: 0
Views: 116
Reputation: 26886
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.
Upvotes: 1