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 Hello extends MIDlet implements CommandListener{ private Display display; private Form form; private Command next; private Command back; private Image image; private int slideNunm; private int maxSlideNum=5; public void startApp(){ display = Display.getDisplay(this); form = new Form(null); form.setCommandListener(this); next = new Command("Next", Command.OK, 1); form.addCommand(next); back = new Command("Back", Command.BACK, 1); form.addCommand(back); Ticker t = new Ticker("Галерея"); form.setTicker(t); setImage("/images/1.png"); display.setCurrent(form); } public void commandAction(Command c, Displayable d) { if (с == next && slideNum1) slideNum--; form.delete(0); setImage("/images/"+Integer.toString(slideNum)+".png"); } public void setImage(String path){ try { image = Image.createImage(path); } catch (IOException ioe){ System.out.println(ioe.getMessage()); } form.append(image); } }