import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Midlet extends MIDlet implements CommandListener { Display display; Emulator emul Command ok = new Command("Ok", Command.OK, 0); public void startApp() { if(display == null){ initApp(); } } public void initApp(){ display = Display.getDisplay(this); 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.setCurrent(form); } public void pauseApp() { } public void commandAction(Command c, Displayable d){ if(c==ok) display.setCurrent(emul); } public void destroyApp(boolean unconditional) { } }