Week 10 - J2Me, Midlet: Co 4307 - Tutorial Slides
Week 10 - J2Me, Midlet: Co 4307 - Tutorial Slides
Week 10 - J2Me, Midlet: Co 4307 - Tutorial Slides
• import javax.microedition.lcdui.*;
• import javax.microedition.midlet.*;
• public class HelloMIDlet extends MIDlet implements
CommandListener { private Form mMainForm;
• public HelloMIDlet() { mMainForm = new Form("HelloMIDlet");
mMainForm.append(new StringItem(null, "Hello, MIDP!"));
mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));
mMainForm.setCommandListener(this); }
• public void startApp()
{ Display.getDisplay(this).setCurrent(mMainForm); }
• public void pauseApp() {}
• public void destroyApp(boolean unconditional) {}
• public void commandAction(Command c, Displayable s)
{ notifyDestroyed(); } }