Does anyone here use the Java ME Plaform SDK from Sun to make games for mobile phones?


I don’t know how to include png images in my mobile games. Any help on how to do this would be greatly appreciated.


I don’t write Java ME but see how this link can help


Thanks for the link, The development environment for Java ME they used was the Wireless toolkit instead of the more recent Java ME Platform SDK 3.0.

I have written two mobile games already, but having to code every line of the game’s display(using g.drawRect() and g.drawArc() methods and so on) leads to not too fancy graphics and relatively more coding effort.

What I really need is how to use the ME SDK to make my games have picture images. Thanks anyway.


I dot really get your question but if you just want to display an image, then drawImage it is:
g.drawImage(image, x, y, anchor);
Note however that proper game animation is accomplished via the GameCanvas, Sprite, Layer, TiledLayer and TileManager classes.


And by the way, the image parameter in the above can be gotten via:
Image image = g.createImage(imageSourceHere);
and then something like…
g.drawImage(image, 0, 0, GRAPHICS.BOTTOM|GRAPHICS.LEFT)


I’m sorry, but I get all this. The thing is if you are using the Java ME Platform SDK, in which directory do you place the image?
@Kehers should the path to the png image be a string to be placed within the createImage method?


You can place the images in any folder as long as u link well to it. I do put mine in a ‘res’ folder. To make the sdk recognize the folder as the resource folder, u av to edit your project property. I cant remember the property filename/path now. Will look it up and hit back.
And yes, the createMethod param can be string.


Oops…sorry I forgot I am to do a lookup…
Here: you can find the project property file in d nbproject folder in d folder or d projecct/app u r working on. It is named “”. Just open wit an editor and do the following mod:
set “resources.dir=resources” (if not so already)
add/set “file.reference.urProjectName-res=res”
add/set “libs.classpath=${file.reference.urProjectName-res=res}”.
And thats all. There should be easier ways to it but this is how I do mine. Share if u find other ways.


I’m so excited. I just figured out the easier way to include images in Java ME games using the Java ME Platform SDK. I was able to find the way only because you had suggested that one may exist. Here’s what to do:
Within your project’s directory create a folder where you want your images to be. Call the folder res. Start-up your Java ME SDK. Open up the directory structure of your project from the projects panel. Right click on resources, and then click on ‘add folder’. A dialog box will appear where you should see your ‘res’ folder. Choose this folder, and you are all done. You can then do the following withing the paint method of a Canvas:

Image introImage = Image.createImage("/JessicaAlbaLooksReallyGood.png");

try{Thread.sleep(4000);}catch(InterrutpedException exp){}

//Other stuff you like.
I hope this has been helpful.
The first help I gave online. Wo hoo!!!


Just great, I av been using d long journey afterall. Tnx for sharing.
By d way, av a twitter or social handle? 'd love to see some of ur works. I’m on twitter via @kehers


i’m on both facebook and twitter,but i don’t visdit twitter nearly as much as i visit real name is efe ariaroo. Are u on facebook? One of my recent works, garden of aiden is at download it,play it and tell me wat u tink. Thanks


it’s my third mobile game. When i write a mobile game i send it to my phone via bluetoth. I know there are still a lot of bugs in game.


Tryg to download at d mo…sent u a request on fb. I tnk u shld get on twitter more. Dats whr u meet more geeks and share more ideas.
I do utility apps. Games are complex, esp wit d graphics pixelation.
By d way, I recommend u use for file sharing. Free and impressive.


I’ll check it out.