import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Midlet extends MIDlet implements CommandListener { Command ok = new Command("Ok", Command.OK, 0); public void startApp() { Display display = Display.getDisplay(this); if(display==null){ initApp(); } } public void initApp(){ Emulator emul = new Emulator(); Form form = new Form("CHIP-8 Emulator"); form.append("Loading..."); emul.loadGame(); if(emul.gameLoaded == true){ form.deleteAll(); form.append("Game loaded"); form.addCommand(ok); form.setCommandListener(this); } Display.getDisplay(this).setCurrent(form); } public void pauseApp() { } public void commandAction(Command c, Displayable d){ if(c==ok) Display.getDisplay(this).setCurrent(new Emulator()); } public void destroyApp(boolean unconditional) { } }