如何在gwt中更改g:image的网址 [英] How to change the url of a g:image in gwt
本文介绍了如何在gwt中更改g:image的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是GWT的新手. 我在ui.xml中创建了一个包含图像的面板. 我想更改网址alt&该图像的标题取决于某些条件.怎么做?
I'm new to GWT. I created in my ui.xml a panel containing an Image. I want to change the url, the alt & the title of that image depending some conditions. How to do it ?
<g:Image url="images/document-statut-1.gif" title="My title" altText="My alt"></g:Image>
Thnx
推荐答案
修改uibinder元素,使其具有字段名称:
Modify the uibinder element so it has a field name:
<g:Image url="images/document-statut-1.gif" ui:field="imageWidget"
title="My title" altText="My alt" />
然后在您的Java代码中创建一个匹配字段:
Then make a matching field in your java code:
@UiField
Image imageWidget;
在Java类中调用createAndBind
方法后,您都可以分配一个新的URL:
Any time after you call the createAndBind
method in your java class, you can then assign a new url:
imageWidget.setUrl("images/newStatus.gif");
这篇关于如何在gwt中更改g:image的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文