当我尝试运行项目时,ListBox中的项目不会出现

时间:2015-01-16 07:18:27

标签: gwt

这是我的代码,在我的列表框中甚至没有看到任何单词。有什么问题?

idStore = new ListStore<Category>(new ModelKeyProvider<Category>() {

            @Override
            public String getKey(Category item) {
                return item.getIdcategory() + "";
            }
        });
        idStore.addAll(list);

        lb = new ListBox();
        LabelProvider<Category> lp = new LabelProvider<Category>() {

            @Override
            public String getLabel(Category item) {
                lb.addItem(item.getStrName());
                return item.getStrName();
            }
        };
        lb.setVisibleItemCount(5);
        lb.setMultipleSelect(true);

        vlc.add(new FieldLabel(lb, "Categories"), new VerticalLayoutData(1, -1, new Margins(10)));

1 个答案:

答案 0 :(得分:0)

为什么不尝试类似这样:

lb.setVisibleItemCount(1);

这将启用正确的下拉列表框。我想你还必须将你的组件添加到root面板。

相关问题