日期:2014-05-20  浏览次数:20791 次

求高高手相助(有关StringiTme)
StringItem   item   =   new   StringItem( "选择航次: ", " ");  
item.setDefaultCommand(CMD_GO);  
item.setItemCommandListener(this);这几句,现在如果我去掉item.setItemCommandListener(this);,编译成功,否则它显示  
C:\WTK25\apps\PortPDA\src\PickUpScreen.java:37:   无法将   javax.microedition.lcdui.Item   中的   setItemCommandListener(javax.microedition.lcdui.ItemCommandListener)   应用于   (PickUpScreen)  
item.setItemCommandListener(this);  
^  
1   错误  
com.sun.kvem.ktools.ExecutionException  
生成失败  

求问问题怎么解决???  
源程序  
:  
import   javax.microedition.lcdui.*;  
import   javax.microedition.io.*;  
import   javax.microedition.rms.*;  
import   java.io.*;  
import   java.util.*;  

public   class   PickUpScreen   extends   Form   implements   CommandListener  
{  
private   Display   display;  
private   Displayable   parent;  
private   static   final   Command   CMD_GO   =   new   Command( "Go ",   Command.ITEM,   1);  
private   Command   okCommand,exitCommand,backCommand,queryCommand;  
private   TextField   inputIP   =   null;  
private   String   strIP=null;  
private   Image   anImage=null;  
private   StringItem   info=null;  
private   ImageItem   res=null;  

//private   StringItem   item=null;  
private   StringItem   thdh=null;  
private   StringItem   hw=null;  
private   StringItem   dw=null;  
private   TextField   sl=null;  
private   DateField   rq=null;  
private   ChoiceGroup   gb=null;  

private   Table   grid   =   null;  

public   PickUpScreen(Display   _display,Displayable   _parent)  
{  
super( "   提货 ");  
display   =   _display;  
parent   =   _parent;  

StringItem   item   =   new   StringItem( "选择航次: ", " ");  
item.setDefaultCommand(CMD_GO);  
item.setItemCommandListener(this);  
this.append(item);  
thdh   =   new   StringItem( "提货单号: ", " ");  
hw   =   new   StringItem( "选择货位: ", " ");  
dw   =   new   StringItem( "货物单位: ", " ");  
sl   =   new   TextField( "提货数量: ", "0 ",5,TextField.NUMERIC);  
String[]   typeStrings   =   {   "一工班 ",   "二工班 ",   "三工班 "};  
rq   =   new   DateField( "提货日期: ",DateField.DATE);//DATE_TIME  
ChoiceGroup   gb   =   new   ChoiceGroup( "工班 ",   ChoiceGroup.POPUP,   typeStrings,   null);  
grid   =   new   Table( "表格 ",display);  
info   =   new   StringItem( " ", " ");  
res   =   new   ImageItem( " ",null,Item.LAYOUT_DEFAULT, " ");  
exitCommand   =   new   Command( "回主页 ",Command.EXIT,2);  
okCommand   =   new   Command( "设定 ",Command.OK,2);  
this.append(thdh);