It is necessary to display the icon on the Canvas. I use the method:

drawImage(image, x1, y1, w1, h1, x1, y1, w1, h1); 

The picture is set as a resource:

 public interface Bundle extends ClientBundle { public static final Bundle ourInstance = GWT.create(Bundle.class); @ClientBundle.Source(value = {"icon.png"}) public ImageResource icon(); } 

At the moment of drawing, the karinka is 100% loaded (onLoad was called). But still the picture is not drawn, an exception falls:

com.google.gwt.core.clients .shell.ModuleSpaceOOPHM.doInvoke (ModuleSpaceOOPHM.java:132) at com.google.gwt.dev.shell.ModuleSpace.invokeNative (ModuleSpace.java lower 61) at com.google.gwt.dev.shell.ModuleSpace.invoke nativeVoid (Module .java: 289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid (JavaScriptHost.java:107) at MyClassCanvas.drawImage (MyClassCanvas.java)

    1 answer 1

    Change

     Image img = new Image(Bundle.ourInstance.icon()) 

    on

     Image img = new Image(Bundle.ourInstance.icon().getURL)