View Full Version : Setting icon to toggle button greater than 16x16

8 Nov 2011, 7:11 AM

How can I change icon in toggle button to be greater than 16px x 16px ?

I'm setting the icon by style background:


Icon is always clipped to 16x16. Firebug shows me that there's a table rendered inside of my ToggleButton which has something like this inside:

<img onload="this.__gwtLastUnhandledEvent=&quot;load&quot;;" src="" style="width: 16px; height: 16px; background-image: url(; position: absolute; left: 0px; top: 8px; background-position: 0px 0px; background-repeat: no-repeat no-repeat; " border="0" role="presentation" class=" x-btn-image">
As you can see width and height are set somewhere else I don't know where in GXT.

I've tried:

tgBtn.setSize(30, 30);
which resulted in making whole toggle button bigger, but icon is stil 16x16

and I've tried

but it didn't work.

I have even used

ClippedImagePrototype bla = new ClippedImagePrototype("../images/inter.gif", 0, 0, 23, 23);
And the icon was visible all the way, but: It haven't put the image in the center of Toggle Button but next to its right edge.

I don't want to have urls inside my code. I want them in css

This is internal class of GWT as it states in its source:
* Implementation of {@link AbstractImagePrototype} for a clipped image. This
* class is used internally by the image bundle generator and is not intended
* for general use. It is subject to change without warning.

What can I do ?

8 Nov 2011, 7:22 AM

That will make your button already larger.

Than you need to do something like
tgBtn.setIcon(IconHelper.createStyle("interactiveMode", 23,23));