View Full Version : How do I add images to my GXT project

21 May 2012, 9:24 AM
I've found some stuff here and there, but none of it seems to be working properly. It appears that I should be creating an interface that extends ClientBundle, but it simply doesn't show up when I add the ImageBundle.

Can someone help me with this, please?

22 May 2012, 1:25 AM
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;

public interface Icons extends ClientBundle
Icons INSTANCE = GWT.create(Icons.class);

ImageResource getMySampleImage();

From your class, use the Icons Interface as follows:

ContentPanel cp = new ContentPanel();
final Image mySampleImage = new Image(Icons.INSTANCE.getMySampleImage());

Hope this helps you... ;)