textbox.setCommandListener的问题
代码如下
disp = Display.getDisplay(this);
cmdExit = new Command("退出",Command.SCREEN,1);
cmdOK = new Command("确定",Command.OK,1);
textbox = new TextBox("请输入....序号","",40,0);
textbox.addCommand(cmdExit);
textbox.addCommand(cmdOK);
textbox.setCommandListener(this);
该行报错textbox.setCommandListener(this);要求this强制为CommandListener
如下:
textbox.setCommandListener((CommandListener)this);
就能正常编译,但是按钮时间不能调用了
不知道是什么原因?