我用myeclipse运行J2ME程序为什么模拟器一闪而过,为什么,怎么解决?请诸位高手们帮帮忙?

我的程序代码是:importjavax.microedition.lcdui.*;importjavax.microedition.midlet.*;publicclas... 我的程序代码是:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class HelloWorld extends MIDlet implements CommandListener{
private Command exitCommand;
private TextBox tb;
public HelloWorld(){
exitCommand=new Command("Exit",Command.EXIT,1);
tb=new TextBox("Hello MIDlet","Hello Java World!",12,0);
tb.addCommand(exitCommand);
tb.setCommandListener(this);
}
protected void startApp() throws MIDletStateChangeException{
Display.getDisplay(this).setCurrent(tb);
System.out.println("startApp");
}
protected void pauseApp(){
System.out.println("pauseApp");
}
protected void destroyApp(boolean c) throws MIDletStateChangeException{
System.out.println("destroyApp");
}
public void commandAction(Command c,Displayable d){
if(c==exitCommand){
try{destroyApp(false);
}catch(MIDletStateChangeException exception){
System.out.println("MIDletStateChangeException");
}
notifyDestroyed();
}
}
}
运行以后在console面板中出现:
正在通过存储根 C:\Users\lenovo\j2mewtk\2.5.2\appdb\DefaultColorPhone 来运行
Running with locale: Chinese (Simplified)_People's Republic of China.936
Running in the identified_third_party security domain
java.lang.IllegalArgumentException
at javax.microedition.lcdui.TextField.setChars(+105)
at javax.microedition.lcdui.TextField.setString(+27)
at javax.microedition.lcdui.TextField.<init>(+168)
at javax.microedition.lcdui.TextBox.<init>(+74)
at HelloWorld.<init>(+35)
at java.lang.Class.runCustomCode(+0)
at com.sun.midp.midlet.MIDletState.createMIDlet(+34)
at com.sun.midp.midlet.Scheduler.schedule(+52)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
Execution completed.
3387201 bytecodes executed
46 thread switches
1667 classes in the system (including system classes)
17772 dynamic objects allocated (533496 bytes)
2 garbage collections (456816 bytes collected)
谢谢了!
展开
 我来答
抹煞星
2012-02-22 · 超过10用户采纳过TA的回答
知道答主
回答量:35
采纳率:0%
帮助的人:30.4万
展开全部
tb=new TextBox("Hello MIDlet","Hello Java World!",12,0);

Hello Java World!已经查过12个字符了,把最大值设置大点

tb=new TextBox("Hello MIDlet","Hello Java World!",100,0);
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式