我想在 CellTable 的单元格中添加图像。阅读文档后,这就是我所做的,
Column<Contact, String> imageColumn = new Column<Contact, String>(new ImageCell()) {
@Override
public String getValue(Contact object) {
return "contact.jpg";
}
};
table.addColumn(imageColumn, "");
好吧,现在表中有一个空列,其中没有图像。我在这里做错了吗?任何建议表示赞赏。谢谢你。
请您参考如下方法:
使用 ImageResourceCell :
interface Resources extends ClientBundle {
@Source("image-path.png")
ImageResource getImageResource();
}
Resources resources = GWT.create(Resources.class);
Column<Contact, ImageResource> imageColumn =
new Column<Contact, ImageResource>(new ImageResourceCell()) {
@Override
public ImageResource getValue(Contact object) {
return resources.getImageResource();
}
};




