GWT列表框 - 如何使用文本查找项目索引? [英] GWT listbox - how to look up item index using text?

查看:59
本文介绍了GWT列表框 - 如何使用文本查找项目索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用GWT列表框中的项目文本查找项目的索引号?

解决方案

通过它们找到它并找到你自己的索引。

像这样:

  String text =listBoxText; 
int indexToFind = -1;
for(int i = 0; i< listBox.getItemCount(); i ++){
if(listBox.getItemText(i).equals(text)){
indexToFind = i;
休息;
}
}


Is there anyway to look up an item's index number using the item text in GWT listbox?

解决方案

Nope, you have to iretare thru them and find that index yourself.

Like this:

String text = "listBoxText";
int indexToFind = -1;
for (int i=0; i<listBox.getItemCount(); i++) {
    if (listBox.getItemText(i).equals(text)) {
        indexToFind = i;
        break;
    }
}

这篇关于GWT列表框 - 如何使用文本查找项目索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆