Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package piar;
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.CommandListener;
- import javax.microedition.lcdui.Display;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Form;
- import javax.microedition.lcdui.Item;
- import javax.microedition.lcdui.StringItem;
- import javax.microedition.lcdui.TextField;
- import javax.microedition.midlet.MIDlet;
- import javax.microedition.midlet.MIDletStateChangeException;
- public class HelloWorld extends MIDlet implements CommandListener {
- Form helloForm;
- Command exitCommand;
- Display display;
- public HelloWorld() {
- }
- protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
- }
- protected void pauseApp() {
- }
- protected void startApp() throws MIDletStateChangeException {
- display = Display.getDisplay(this);
- // Hello form
- helloForm = new Form ("Welcome", new Item[] {
- new StringItem("Hello", "Hello world"),
- new TextField("Text field", "Enter some text here", 50, TextField.ANY)
- });
- helloForm.setCommandListener(this);
- exitCommand = new Command("Exit", Command.EXIT, 0);
- helloForm.addCommand(exitCommand);
- display.setCurrent(helloForm);
- }
- public void commandAction(Command command, Displayable displayable) {
- if (command == exitCommand) {
- display.setCurrent(null);
- notifyDestroyed();
- }
- }
- }
Add Comment
Please, Sign In to add comment