Friday, December 4, 2009

Hello World

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.midlet.MIDlet; 

public class HelloWorld extends MIDlet implements CommandListener { 
    public HelloWorld() { } 
    public void startApp() { 
        Form form = new Form("Hello world!"); 
        form.addCommand(new Command("Exit",Command.EXIT,1)); 
        form.setCommandListener(this);
        Display.getDisplay(this).setCurrent(form); 
    }
    public void pauseApp() { } 
    public void destroyApp(boolean unconditional) { } 
    public void commandAction(Command c,Displayable d) { 
        if(c.getCommandType() == Command.EXIT) { 
            notifyDestroyed(); 
        } 
    } 
} 

No comments:

Post a Comment