| |
| 1 |
package com.aniruddha.j2me.hello; |
| 2 |
|
| 3 |
import javax.microedition.midlet.MIDlet; |
| 4 |
import javax.microedition.midlet.MIDletStateChangeException; |
| 5 |
|
| 6 |
import javax.microedition.midlet.*; |
| 7 |
import javax.microedition.lcdui.*; |
| 8 |
|
| 9 |
public class HelloWorld extends MIDlet implements CommandListener { |
| 10 |
private Command exitCommand; |
| 11 |
private TextBox tbox; |
| 12 |
|
| 13 |
public HelloWorld() { |
| 14 |
exitCommand = new Command("Exit", Command.EXIT, 1); |
| 15 |
tbox = new TextBox("Hello world MIDlet", "Hello World!", 25, 0); |
| 16 |
tbox.addCommand(exitCommand); |
| 17 |
tbox.setCommandListener(this); |
| 18 |
} |
| 19 |
|
| 20 |
protected void startApp() { |
| 21 |
Display.getDisplay(this).setCurrent(tbox); |
| 22 |
} |
| 23 |
|
| 24 |
protected void pauseApp() {} |
| 25 |
protected void destroyApp(boolean bool) {} |
| 26 |
|
| 27 |
public void commandAction(Command cmd, Displayable disp) { |
| 28 |
if (cmd == exitCommand) { |
| 29 |
destroyApp(false); |
| 30 |
notifyDestroyed(); |
| 31 |
} |
| 32 |
} |
| 33 |
} |
|
|
| |