java me - displaying image in j2me application -


How do I create and display an image in the j2me application?

And what folder can I put in my image in that image?

is exactly what you are looking for to get started.

Basically, to create an image, you call the image .createImage ();

  image img = Image.createImage ("/ imageName.png");  

If it is in a subfolder in jar:

  image img = Image.createImage ("/ subDir / imageName.png");  

In order to display an image, you need to draw a canvas with a graphics example which is connected to the canvas (better viewed in the link above is).

  Public Zero Color (Graphics G) {... g.drawImage (IMG, 0, 0, Graphics.TP | Graphics. LEFT); ....}  

You can also use the Graphics.drawRegion function, but for J2ME you can see for JavaDocs that is best for your needs.


Comments