" />
开发者

cannot get ui:image work

I tried to use gwt's uiBinder to get an image, but it wont' work,

in the .xml file, i defined:

<ui:with field='res' type="com.my.services.email.client.Resources"/>
<ui:image field="testImage" resource="{res.calIcon}">

and i have a Resources.java file开发者_JAVA技巧 to define the image resource:

public interface Resources extends ClientBundle {
 Resources INSTANCE = GWT.create(Resources.class);

        @Source("img/cal.png")
 ImageResource calIcon();
}

and gwt complained:

[ERROR] No com.google.gwt.resources.client.ClientBundle$Source annotation and no resources found with default extensions

anyone knows what's wrong with this? Thanks!


I faced the same problem, and after several reading and trying, I found that there is no need to declare the image tag in order to access the image, once you declare <ui:with field='res' type="com.my.services.email.client.Resources"/> you can retrieve the image directly.

This is my code, I used two images for a Pushbutton

<ui:with field='res' type='com.ttt.client.resources.ImageResources'/>
  ...
      <g:PushButton ui:field='r0Button'>
          <g:upFace image='{res.icoStatusR0}'>R0</g:upFace>
          <g:downFace image='{res.icoStatusR0pushed}'>R0</g:downFace>
      </g:PushButton>
  ...

For the resource file, make sure that the path of the images is correct. I used the Wizard to generate mine, so I'am sure that the path is correct.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜