Reputation:
I have a UIBinder java class in gwt which contain a label with some text like
Label img = new Label();
img.setText("<img src=h.png></img>") or some other Html tag like div
and add this label in HTMLPanel
HTMLPanel html = new HTMLPanel;
html.add(img,"img");
now I have a table in uibinder xml like
<table align="center" cellspacing="20px">
<tr>
<td>image</td>
<td id="image"></td>
</tr>
<table>
but here I am getting a string
"<img src=h.png></img>"
not a image please some one help me..
Upvotes: 2
Views: 2346
Reputation: 41099
There is no need to use Label widget if you need an Image. If you use an ImageResource, you can do:
// Link to your ClientBundle with ImageResource methods
<ui:with type="com.myPackage.client.icons.Icons" field="icon" />
<g:Image ui:field="myImage" resource="{icon.myImage}" />
If you don't need this image to do anything, then you can simply use regular HTML:
<g:HTMLPanel>
<img src="h.png" />
</g:HTMLPanel>
Upvotes: 5