我正在尝试创建一个简单的诺基亚 s40 应用程序来添加两个数字(仅供练习),我在代码中找不到任何错误,所以请帮忙,
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class main extends MIDlet {
Display disp;
Form start;
TextField a, b;
StringItem sum;
main(){
disp = Display.getDisplay(this);
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-g enerated method stub
}
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
start = new Form("Start");
a = new TextField("A", "Enter A", 40, TextField.NUMERIC);
b = new TextField("B", "Enter B", 4, TextField.NUMERIC);
sum = new StringItem("Sum", "hello");
start.append(a);
start.append(b);
start.append(sum);
disp.setCurrent(start);
}
}
但是,当我注释掉这两行时,我的代码开始工作但没有显示,请帮忙。
a = new TextField("A", "Enter A", 40, TextField.NUMERIC);
b = new TextField("B", "Enter B", 4, TextField.NUMERIC);
start.append(a);
start.append(b);