import javax.microedition.lcdui.*; import javax.microedition.midlet.MIDlet; public class SlideShow extends MIDlet implements CommandListener { Display display; Form form; Command next; Command back; Image image; int slideNum; int maxSlideNum; public void startApp() { display = Display.getDisplay(this); form = new Form(null); form.setCommandListener(this); next = new Command("Next", 4, 1); form.addCommand(next); back = new Command("Back", 2, 1); form.addCommand(back); Ticker ticker = new Ticker("My Photoalbum"); form.setTicker(ticker); setImage("/1.png"); display.setCurrent(form); } public void commandAction(Command command, Displayable displayable) { if (command == next && slideNum < maxSlideNum) slideNum++; if (command == back && slideNum > 1) slideNum--; form.delete(0); setImage("/".concat(String.valueOf(Integer.toString(slideNum))).concat(".png")); } public void setImage(String string) { try{ Exception e; image = Image.createImage(string); } catch(Exception e){} form.append(image); } public void pauseApp() { } public void destroyApp(boolean flag) { } public SlideShow() { maxSlideNum = 3; } }