File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes images in palm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "images in palm" Watch "images in palm" New topic
Author

images in palm

sameetbm
Greenhorn

Joined: Aug 01, 2001
Posts: 1
i have made a game in midlet and the converted it into prc for palm.When i draw images with the drawRect() method etc .the game works fine on mobile emulators and palm.But when i use a png image in the midlet it works with the cell phones but when i convert the same file using the j2me toolkit in to prc it doesnot work.what i wanted to know was whether u can load images in palm.
Thank u
chanoch wiggers
Author
Ranch Hand

Joined: May 24, 2001
Posts: 245
png files are supported by the midp for palm - I've seen it working, what file is it that you converting to prc, the whole lot needed for the app or just the image?
------------------
Chanoch Wiggers
Architect for Professional Java Mobile Programming


chanoch<p><a href="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
sebastien GUERLET
Greenhorn

Joined: Jun 28, 2001
Posts: 13
Here is a simple piece of code, just put your PNG in the JAR before convert it :
Image img = null;
Form f = new Form("Hello MIDlet");
try {
img = Image.createImage("/test/empty.png");
} catch (IOException ioe) {ioe.printStackTrace();}
ImageItem ii = new ImageItem("Essai d'image ",img,ImageItem.LAYOUT_RIGHT,null);
f.append(ii);
Matt Midcap
Sheriff

Joined: Jan 07, 1999
Posts: 440
"sameetbm",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.


Best Regards,<br />Matt Midcap
sameet bm
Greenhorn

Joined: Aug 02, 2001
Posts: 4
thanks sebastein and chanoch for the replies.I tried the way which Sebastein has suggested but it didnot work.I will be a little more specific with my problem .
*Form f = new Form("Hello MIDlet");
try {
img = Image.createImage("/snake.png");
}
catch (IOException ioe) {ioe.printStackTrace();}
*ImageItem ii = new ImageItem("snake ",img,ImageItem.LAYOUT_RIGHT,null);
*f.append(ii);
message=""+a+" "+b+"hello";
g.drawImage(img, 0, 0, g.TOP|g.LEFT);
This the code i am using to draw images in the midlet.* is for the code which sebastein has suggested.When i write the java file and build a jar and jad file it works with the mobile phone emulators.But when i conver this file in to prc file with the j2me toolkit it doesnot work .My guess is that it is not able to load the image in the try block but it doenot throw any exception and the screen remains blank.can u please suggest me any remedy or send me complete sample code for loading the images .This is very urgent.
Thank u
sameet bm
Greenhorn

Joined: Aug 02, 2001
Posts: 4
thanks sebastein and chanoch for the replies.I tried the way which Sebastein has suggested but it didnot work.I will be a little more specific with my problem .
*Form f = new Form("Hello MIDlet");
try {
img = Image.createImage("/snake.png");
}
catch (IOException ioe) {ioe.printStackTrace();}
*ImageItem ii = new ImageItem("snake ",img,ImageItem.LAYOUT_RIGHT,null);
*f.append(ii);
message=""+a+" "+b+"hello";
g.drawImage(img, 0, 0, g.TOP|g.LEFT);
This the code i am using to draw images in the midlet.* is for the code which sebastein has suggested.When i write the java file and build a jar and jad file it works with the mobile phone emulators.But when i conver this file in to prc file with the j2me toolkit it doesnot work .My guess is that it is not able to load the image in the try block but it doenot throw any exception and the screen remains blank.can u please suggest me any remedy or send me complete sample code for loading the images .This is very urgent.
Thank u
sameet bm
Greenhorn

Joined: Aug 02, 2001
Posts: 4
another thing i am using canvas and not form

thank u
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: images in palm