有没有办法使用GWT列表框中的项目文本来查找项目的索引号?
发布于 2011-08-09 02:33:33
不,你必须仔细阅读它们,自己找到那个索引。
如下所示:
String text = "listBoxText";
int indexToFind = -1;
for (int i=0; i<listBox.getItemCount(); i++) {
if (listBox.getItemText(i).equals(text)) {
indexToFind = i;
break;
}
}https://stackoverflow.com/questions/6986793
复制相似问题