1

在我的 GWT 应用程序中,我还将 SmartGWT 库用于一些用户界面元素。最近我有了用 SmartGWT 图标集中的图标替换某些 GWT 按钮的文本(如“刷新”或“保存”)的想法,例如/com/smartclient/theme/graphite/public/sc/中的刷新图标皮肤/石墨/图像/动作/refresh.png

我尝试使用限定名称在我的 UiBinder 模板中使用该图标:

    <ui:image field="refreshIcon" resource="/com/smartclient/theme/graphite/public/sc/skins/Graphite/images/actions/refresh.png" />

并将其用于按钮:

    <g:PushButton ui:field="refreshButton" styleName="{style.Buttons}">
        <g:upFace image="{refreshIcon}" />
    </g:PushButton>

不幸的是,这不起作用,eclipse没有什么可抱怨的,但是在运行应用程序时我收到了这个错误:

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

如何将引用的smartgwt.jar库中的捆绑图标用于我的 PushButton?

4

1 回答 1

2

该属性被命名src,而不是resource

<ui:image field="refreshIcon" src="/com/smartclienttheme/graphite/public/sc/skins/Graphite/images/actions/refresh.png" />

附带说明一下,只要图像位于类路径中,图像的来源就无关紧要:GWT 从类路径中加载所有内容,无论是在 JAR 中还是在文件夹中都无关紧要。

于 2012-09-16T23:14:44.233 回答