what is wrong with this create image code.It is simplest code.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   maneesh_sata
Posted On:   Monday, October 28, 2002 05:42 PM

hi all! i hv a problem in runing an image program.i hv this program from a tutorial and an io exception occurs what is wrong with code. I m using jbuilder 6 and also keeping image in src folder. thanks earlier;here is my simplest code:- import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.util.*; public class PhoneImage1 extends MIDlet implements CommandListener, ItemStateListener { private Command exitCommand; //The display for this MIDlet    More>>

hi all!


i hv a problem in runing an image program.i hv this program
from a tutorial and an io exception occurs what is wrong with code. I m using jbuilder 6 and also keeping image in src folder.




thanks earlier;here is my simplest code:-



import javax.microedition.midlet.*;


import javax.microedition.lcdui.*;



import java.util.*;









public class PhoneImage1 extends MIDlet




implements CommandListener,
ItemStateListener {







private Command exitCommand;




//The display for this MIDlet




private Display display;








Form displayForm;



Image image;




public PhoneImage1() {



display = Display.getDisplay(this);



exitCommand = new Command("Eit", Command.SCREEN, 2);



try
{


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



}



catch (java.io.IOException ioExc)



{



ioExc.printStackTrace();



}






}






public void startApp() {




displayForm = new Form("Imagitem");



displayForm. append(
new ImageItem("Default Layout",
image,

ImageItem.LAYOUT_DEFAULT,

"Image Cannot be shown"));



displayForm.addCommand(exitCommand);





displayForm.setCommandListener(this);




displayForm.setItemStateListener(this);



display.setCurrent(displayForm);



}






public void itemStateChanged(Item item)



{






}






public void pauseApp() { }






public void destroyApp (boolean unconditional) { }







public void commandAction (



Command c, Displayable s) {




if (c == exitCommand) {




destroyApp(false);




notifyDestroyed();




}




}




}

   <<Less

Re: what is wrong with this create image code.It is simplest code.

Posted By:   wang_huqing  
Posted On:   Monday, October 28, 2002 09:00 PM

I think you should put the image "JavaP.png"on your rsc folder ,which contain all resource files ,not src folder.
About | Sitemap | Contact