代码如下
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里把你的代码黏贴上去就可以了