import javax.microedition.midlet.MIDlet; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.Ticker; import java.io.IOException; public class SlideShow extends MIDlet impliments CommandListener { private Display display; private Form form; private Command next; private Command back; private Image image; private int slideNum private maxslideNum=5 public void startApp() display = Display.getDisplay(this); form = new Form(null); form.setCommandListener(this); next = new Command("Next", Command.OK, 1); back = new Command("Back", Command.BACK, 1); form.addCommand(next); form.addCommand(back); Ticker t = new Ticker("My Photoalbum"); form.setTicker(t); setImage("/1.png"); display.setCurrent(form); } public void commandAction(Command c, Displayable d) { if(c == next && slideNum1) slideNum-; form.delete(0); setImage("/"+Integer.toString(slideNum)+".png"); public void setImage(Sting path) { try{ image = Image.createImage(path); } catch(IOException ioe) {System.out.printIn(ioe.getMessage()); } }