Almost exactly the same way.  If you are only interested in failure:

public void foo() {
   image.addErrorHandler(new ErrorHander() {
      public void onError(ErrorEvent event) {
         ...
      }
   });
}

Or if you are interested in both success and failure, your class can
implement both interfaces or you can to synthesize a third interface
that combines them:

public void foo() {
   interface WinAndLose extends LoadHandler, ErrorHander { }

   WinAndLose wal = new WinAndLose() {
      public void onLoad(LoadEvent event) {
      }

      public void onError(ErrorEvent event) {
         ...
      }
   }

   image.setErrorHandler(wal);
   image.setLoadHandler(wal);
}


On Jul 15, 3:21 pm, davidroe <[email protected]> wrote:
> how can I determine that an image failed to load, due to perhaps a
> network error?
>
> I used to use image.addLoadListener(new LoadListener() {
>   public void onLoad(Widget sender) {
>     ...
>    }
>    public void onError(Widget sender) {
>      ...
>    }
>
> }
>
> and anything that arrived through onError() was deemed a problem.
>
> how can I achieve the same thing with addLoadHandler(new LoadHandler
> ()) and the associated LoadEvent?
>
> thanks,
> /dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to