dcsimg
J2ME and png?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aslan_Oglu
Posted On:   Wednesday, July 2, 2003 04:59 AM

I just started programmering and I have this problem. When I try to put a .png picture into a form am getting an IOException. This is how I do: public void side(String navn) { Form f = new Form(navn); try{ Image image = Image.createImage("icon.png"); f.append(image); }catch(java.io.IOException e){System.out.println (e);} f.addCommand(backCommand); f.setCommandListener(this); display.setCurrent(f); } can anyone help?    More>>

I just started programmering and I have this problem.

When I try to put a .png picture into a form am getting


an IOException. This is how I do:




public void side(String navn)


{


Form f = new Form(navn);



try{


Image image = Image.createImage("icon.png");


f.append(image);


}catch(java.io.IOException e){System.out.println
(e);}



f.addCommand(backCommand);


f.setCommandListener(this);


display.setCurrent(f);


}






can anyone help?

   <<Less

Re: J2ME and png?

Posted By:   Gralig_Bobik  
Posted On:   Wednesday, July 9, 2003 06:46 AM

Try this :



move picture into "res" directory and change code to :



Image image = Image.createImage("/icon.png");



just take care about lowercase and uppercase extension of picture file ;o)

Re: J2ME and png?

Posted By:   Johnny_Wang  
Posted On:   Thursday, July 3, 2003 01:33 AM

build one .jar file, bundle all classes and png resource in the .jar file.
Image.createImage(filename);
the filename is the relative path with the .jar file.

you can try it.
good luck
About | Sitemap | Contact