How to prefetch image in GWT?
问题 I tried the following code: RootPanel root = RootPanel.get("root"); root.clear(); final FlowPanel p = new FlowPanel(); root.add(p); for (int i=0; i<20; ++i) { String url = "/thumb/"+i; final Image img = new Image(url); img.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { p.add(img); } }); Image.prefetch(url); But it does not work for me. Did I missed something? 回答1: Image load handler is called only in the case, when image is attached to the DOM. So you have