我试图添加一个覆盖插件。https://vaadin.com/directory/component/overlays 我有图像叠加问题。我得到那个错误:
The type com.vaadin.terminal.Resource cannot be resolved.
It is indirectly referenced from required .class file
问题出在这一行:
io.setImage(res);
我该如何解决?我将 icon-new.png 放入类包文件夹并添加到 maven 覆盖插件中
我的代码:
final ImageOverlay io = new ImageOverlay(button);
Resource res = new ClassResource(this.getClass(), "../icon-new.png");
io.setImage(res);
io.setComponentAnchor(Alignment.TOP_LEFT); // Top left of the button
io.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
io.setClickListener(new OverlayClickListener() {
public void overlayClicked(CustomClickableOverlay overlay) {
Notification.show("ImageOverlay Clicked!");
}
});
layout.addComponent(io);
io.setEnabled(true);