2

This image is showing but I can't resize it not matter the width or height values I use. Any thougt? Thankyou.

<ui:with field='res' type='com.hellomvp.client.resources.MyResources'/>

    <ui:style>
        .fortaImage { width:'50px'; height:'50px';} 
    </ui:style>

    <g:DockLayoutPanel unit='EM'>
        <g:north size="10"> 
            <g:FlowPanel>
            <g:Image styleName='{style.fortaImage}' resource='{res.fortaLogo}'/>
            <g:InlineLabel>FortaService</g:InlineLabel>
            <g:ListBox></g:ListBox>
            <g:InlineLabel>DateIn</g:InlineLabel>
            <d:DateBox></d:DateBox>
            <g:InlineLabel>DateOut</g:InlineLabel>
            <d:DateBox></d:DateBox>
            <g:Button>Cerca</g:Button>

            </g:FlowPanel>
        </g:north>



    </g:DockLayoutPanel>
ramon_salla
  • 1,587
  • 1
  • 17
  • 35
  • I described this in another thread. It works with images from ClientBundle resource [link](http://stackoverflow.com/a/10333993/904820) – Hussar Apr 27 '12 at 11:21

2 Answers2

8

When you use <g:Image resource="..."/>, GWT uses a background image. Background images cannot be resized in CSS 2.1. (I really wish it was possible!)

All you can do is either have a 50x50px version of the image on the server, or use <g:Image url="..."/> instead. This creates a normal <img src="..."/> instead of the background image, but you can't specify a ClientBundle resource here.

Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
0
addStyleNames="{style.fortaImage}"

not

styleName='{style.fortaImage}'
antony.trupe
  • 10,640
  • 10
  • 57
  • 84
  • styleName and addStyleNames are both possible. – Chris Lercher Nov 18 '10 at 18:32
  • possible, but styleName overwrites all previous class names instead of adding an additional style name. "Use the styleName attribute to override whatever CSS styling the widget defaults to (just like calling setStyleName() in code). Or, to add class names without clobbering the widget's baked in style settings, use the special addStyleNames attribute: " http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Hello_Stylish_World Regardless, this wasn't the OP's issue after all. – antony.trupe Nov 18 '10 at 19:04