欢迎访问infoheader的Blog——年华似水浪淘沙
E-mail:infoheader@gmail.com
GTalk:infoheader@gmail.com
来自fanfou:

2009年4月28日星期二

J2ME

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener
{
private Display ds;
private Command exitCom;
private TextBox tb;

public HelloWorld()
{
ds=Display.getDisplay(this);
exitCom=new Command("Exit",Command.EXIT,1);
tb=new TextBox("Hello MIDlet","Hello,World!",15,0);
tb.addCommand(exitCom);
tb.setCommandListener(this);
}

protected void startApp(){
ds.setCurrent(tb);
}

protected void pauseApp(){
}

protected void destroyApp(boolean u){
}

public void commandAction(Command c,Displayable d){
if(c==exitCom){
destroyApp(false);
notifyDestroyed();
}
}
}

没有评论: