You need to add the image to the document (e.g. RootPanel.get().add(image) as a bare minimum)
On Thu, Jan 27, 2011 at 9:19 AM, gex <[email protected]> wrote: > Hi, I just tried to load an image in GWT. > > The code is the following: > > final Image image = new Image(); > > > image.addLoadListener(new LoadListener() { > public void onError(Widget sender) { > Test.label.setText("An error occurred while loading."); > } > > public void onLoad(Widget sender) { > Test.label.setText("Image loaded."); > } > }); > > // Point the image at a real URL. > image.setUrl("images/kitty.jpg"); > > The kitty.jpg file is located in war/images folder. > > The test label never shows any of the texts. Also setting breakpoints > in onLoad and onError are never reached. This means that the image is > neither loaded nor an error is raised. What can be the source of this > problem? > > Thanks in advance for your help > > -- > 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]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- 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.
