MyException - 我的异常网
当前位置:我的异常网» J2ME » 初学者请问,在模拟器上ticker无法显示

初学者请问,在模拟器上ticker无法显示

www.MyException.Cn  网友分享于:2013-12-30  浏览:4次
菜鸟请教,在模拟器上ticker无法显示。
代码如下
public class dTextbox extends MIDlet implements CommandListener{
Command cmdExit1 = new Command("EXIT1",Command.EXIT,1);
Display display;
TextBox tbmMain = new TextBox("please input words","very good",255,TextField.ANY);
Ticker tick = new Ticker("gg");
public dTextbox() {
super();
// TODO Auto-generated constructor stub
}

protected void destroyApp(boolean unconditional)
throws MIDletStateChangeException {
// TODO Auto-generated method stub

}

protected void pauseApp() {
// TODO Auto-generated method stub

}

protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub

tbmMain.addCommand(cmdExit1);
tbmMain.setCommandListener(this);

display = Display.getDisplay(this);

tbmMain.setTicker(tick);
display.setCurrent(tbmMain);


}

public void commandAction(Command c,Displayable d)
{


int i = 0;
if(tbmMain.getString().equals("A")||tbmMain.getString().equals("a"))
{
i = 1;
tbmMain.setTicker(tick);
}
else if(tbmMain.getString().equals("B")||tbmMain.getString().equals("b"))
{
i = 2;
tbmMain.setTicker(null);
}
else if (tbmMain.getString().equals("C")||tbmMain.getString().equals("c"))
{
i = 3;
tick.setString("mm");
}
//tick.setString(tick.getString()+"\n"+tbmMain.getString());
tbmMain.setString(tbmMain.getString()+i+tick.getString());

}
}




------解决方案--------------------
Java code
display = Display.getDisplay(this);

tbmMain.setTicker(tick);

------解决方案--------------------
。。。可以显示出来啊,我在NETBEAN里把你的代码黏贴上去就可以了

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有