0

I am using google web toolkit, and I want to enter an URL in a textbox, and display the image from this URL on the page, so I use an ArrayList to handle my images, and a VerticalPanel, to display my images. So I want to add my image to my ArrayList and panel only when the URL is valid, and the data is an image.

I tried with image.addErrorHandler(), but it's not really what I want, I don't know how to use this, to stop the add of my image. So I saw this post from stackoverflow , but I don't understand how it works...

Thank you for your help !

Community
  • 1
  • 1
Apodeus
  • 105
  • 2
  • 7
  • 1
    `RequestBuilder` is probably what you want. Here's a slightly fleshed out example from [Gwt Request builder - how to return the response string](http://stackoverflow.com/questions/15446161/gwt-request-builder-how-to-return-the-response-string). You make the request and supply a `RequestCallback` to handle `onResponseReceived` and `onError`. You display the image if a response is received/the url is valid. You display an error to the user on error. – Jon Sampson Mar 24 '17 at 13:30
  • I think the link in your post is the right solution. – Spiff Mar 25 '17 at 10:50

0 Answers0