Giving ioexception while displaying a simple image.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   maneesh_sata
Posted On:   Saturday, October 26, 2002 08:27 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 private Display display;    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
About | Sitemap | Contact