Questo e' una banale applicazione presa pari pari dalla guida del J2me che dovrebbe caricare un'immagine png. Ebbene, perche' non mi carica un bel niente???codice:import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class ImmutableImage extends MIDlet implements CommandListener { private Display display; private Form form; private Command exit; private Image image; private ImageItem imageItem; public ImmutableImage() { display = Display.getDisplay(this); exit = new Command("Exit", Command.EXIT, 1); form = new Form("Immutable Image Example"); form.addCommand(exit); form.setCommandListener(this); try { image = Image.createImage("Smiley.png"); imageItem = new ImageItem(null, image, ImageItem.LAYOUT_NEWLINE_BEFORE | ImageItem.LAYOUT_LEFT | ImageItem.LAYOUT_NEWLINE_AFTER, "My Image"); form.append(imageItem); display.setCurrent(form); } catch (java.io.IOException error) { Alert alert = new Alert("Error", "Cannot load Smiley.png.", null, null); alert.setTimeout(Alert.FOREVER); alert.setType(AlertType.ERROR); display.setCurrent(alert); } } public void startApp() { } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command command, Displayable Displayable) { if (command == exit) { destroyApp(false); notifyDestroyed(); } } }
Il file Smiley.png l'ho messo un po' dappertutto ma niente...non lo vede. Dovrebbe esser abbastanza banale la soluzione ma non avendo particolare esperienza con il J2me non so come fare...HELP!


Rispondi quotando