1

根据文档,您可以添加要在 uibinder 模板中使用的图像资源,如下所示:

public interface Resources extends ClientBundle {

  @Source("Logo.jpg")
  ImageResource logo();

  ...
}

但是,按原样使用此示例,图像文件 (Logo.jpg) 必须包含在与 Resources.java 相同的目录/包中。我应该把我的图像文件放在哪里,我应该如何列出文件路径,这样我就不必将图像文件保存在我的 src 树中?具体来说,我使用的是 maven - 我不希望我的图像在 src/main/webapp 中,而不是在 src/main/java/com/mygwtapp/client 中吗?

4

1 回答 1

2

You can provide a relative path for your images like this:

@Source("../../resources/images/Logo.jpg")
ImageResource logo();

The path is relative to where your Resources interface is located. And ../ stands for parent directory.

于 2011-08-03T20:01:46.363 回答