import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.io.*; public class main extends MIDlet { private Form form; private Image image; private Display display; private Command next; private Command prev; private int slideNum; private int maxSlidenum = 5; public void startApp() { display = Display.getDisplay(this); try { image = Image.createImage("/1.png"); } catch(IOException ioe) { ioe.printStackTrace(); } form = new Form("Fredi"); form.setCommandListener(this); Ticker t = new ticker("foto"); form.setTicker(t); Command next = new Command("next", Command.OK, 1); form.addCommand(next); Command prev = new Command("back", Command.BACK, 1); form.addCommand(prev); form.append(image); display.setCurrent(form); public void CommandAction(Command c, displayable d) { if c == next && slideNum < maxSlidenum) SlideNum++; if c == back && slideNum > 1 SlideNum - ; form.delete(0); display.vibrate(10000000); SetImage("/" + Integer.toString(slideNum) + ".png"); } public void SetImage(Stringpath) { try { image = Image.createImage(path); } catch(IOException ioe) { ioe.printStackTrace(); } form.append(image); } } public void pauseApp() {} public void destroyApp(boolean f) { notifyDestroyed(); } }