You've probably solved this yourself, but here's what I did:

IResources.java:
==============8<===============
package com.cregganna.web.gwt.ui.resources;

import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;

public interface IResources extends ClientBundle {
    @Source("selectAll_16x16.gif")
    ImageResource selectAllIcon();
...
}
==============8<===============

In the ui.xml:
==============8<===============
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
<ui:UiBinder
  xmlns:ui='urn:ui:com.google.gwt.uibinder'
  xmlns:g='urn:import:com.google.gwt.user.client.ui'
  xmlns:cc='urn:import:com.cregganna.web.gwt.ui'
  >

  <ui:with field='res'
type='com.cregganna.web.gwt.ui.resources.IResources' />
  <ui:with field='msg'
type='com.cregganna.web.gwt.ui.resources.IMessageConstants' />
....

                                <cc:widgets.IconTextButton 
icon='{res.selectAllIcon}'
text='{msg.selectAll}' width='100px' ui:field='selectAll' />
==============8<===============


IconTextButton.java:
==============8<===============
package com.cregganna.web.gwt.ui.widgets;

import com.google.gwt.cell.client.TextButtonCell;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.widget.client.TextButton;

public class IconTextButton extends TextButton {

        public void setIcon(ImageResource icon) {
                ((TextButtonCell) getCell()).setIcon(icon);
        }

}
==============8<===============

On Sep 16, 12:59 pm, tom <[email protected]> wrote:
> Hi,
>
> I'd like to have Buttons with a text and an icon in my app. Seems the
> TextButton<http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/g...>class
>  is exactly what I'm looking for.
>
> The only way to set the icon seems to be the constructor that takes a
> TextButtonCell, but it is protected. Can't use that. :( Bug or feature??
>
> How can I set the icon for a TextButton in a short, elegant way?
>
> regards
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to