HelloWorld:(
谁能给个HelloWorld程序啊?
这个编译通过了但是在模拟器里显示有问题,点launch时抛出null Exception
java.lang.NullPointer Exception
我用的是jdk1.4.2和wkt1.0.4运行示例程序没有问题,不会是配置错了吧??
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloWorld extends MIDlet implements CommandListener
{
private Display display;
private Form props;
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
public HelloWorld()
{
display = Display.getDisplay(this);
}
public void startApp()
{
props = new Form("Hello World");
props.append("Hello World!\n");
props.addCommand(exitCommand);
props.setCommandListener(this);
display.setCurrent(props);
}
public void commandAction(Command c, Displayable s)
{
if (c == exitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
public void destroyApp(boolean unconditional)
{
}
public void pauseApp()
{
display.setCurrent(null);
props = null;
}
}
各位帮帮忙,谢谢了先:)