import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class PMidlet extends MIDlet implements CommandListener { PCanvas canvas; private Command exitMidlet = new Command("Выход",Command.EXIT, 0); public void startApp() { try { canvas = new PCanvas(); canvas.start(); canvas.addCommand(exitMidlet); canvas.setCommandListener(this); Display.getDisplay(this).setCurrent(canvas); } catch(java.io.IOException zxz) { } } public void pauseApp() { } public void destroyApp(boolean unconditional) { if (canvas != null) canvas.stop(); System.gc(); } public void commandAction(Command c, Displayable d) { if (c == exitMidlet) { destroyApp(false); notifyDestroyed(); } } }