Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT ImageBundle问题:图像未显示:包含代码_Gwt - Fatal编程技术网

GWT ImageBundle问题:图像未显示:包含代码

GWT ImageBundle问题:图像未显示:包含代码,gwt,Gwt,我在使用ImageBundle时无法显示图像。我遵循GWT教程作为指导,但是我的图像不显示 我可以在我的浏览器中从Eclipse中很好地查看图像-因此它们肯定在那里。使用ImageBundle时,我显然做错了什么,但我无法理解我做错了什么 logo.jpg图像应该只显示自己 gif应该首先显示自己,以覆盖获取facebook用户配置文件数据的RPC,然后将其替换为pic_square url上的图像 当我查看GWT生成的html时,我发现logo.jpg图像应该在哪里,有一个gif图像[但我不明

我在使用ImageBundle时无法显示图像。我遵循GWT教程作为指导,但是我的图像不显示

我可以在我的浏览器中从Eclipse中很好地查看图像-因此它们肯定在那里。使用ImageBundle时,我显然做错了什么,但我无法理解我做错了什么

logo.jpg图像应该只显示自己

gif应该首先显示自己,以覆盖获取facebook用户配置文件数据的RPC,然后将其替换为pic_square url上的图像

当我查看GWT生成的html时,我发现logo.jpg图像应该在哪里,有一个gif图像[但我不明白这是从哪里来的]

任何帮助将不胜感激-源代码如下

达伦

图像包结构

org.redboffin.sandpit.client.icons  
                           |___ SandpitImageBundle.java
                           |___ ajaxLoader.gif  
                           |___ logo.jpeg
相关类

package org.redboffin.sandpit.client.facebook;

import org.redboffin.sandpit.client.icons.SandpitImageBundle;

import com.google.gwt.core.client.GWT;  
import com.google.gwt.event.dom.client.ErrorEvent;  
import com.google.gwt.event.dom.client.ErrorHandler;  
import com.google.gwt.user.client.Window;  
import com.google.gwt.user.client.rpc.AsyncCallback;  
import com.google.gwt.user.client.ui.AbstractImagePrototype;  
import com.google.gwt.user.client.ui.Button;  
import com.google.gwt.user.client.ui.Composite;  
import com.google.gwt.user.client.ui.DockPanel;  
import com.google.gwt.user.client.ui.HTML;  
import com.google.gwt.user.client.ui.Image;  
import com.google.gwt.user.client.ui.VerticalPanel;  
import com.google.gwt.xml.client.Document;  
import com.google.gwt.xml.client.Element;  
import com.google.gwt.xml.client.XMLParser;  

public class ProfileWidget extends Composite implements RBWidget {

    // Data  
    private String firstName = null;  
    private String lastName = null;  
    private String picSquareUrl = null;  

    // Elements  
    private Image picSquare = new Image();  
    private Image logo = new Image();  
    private Button logoutButton = new Button("Logout");  
    private DockPanel panel = new DockPanel();  
    private HTML html = new HTML("Welcome to Sandpit.");  

    /**  
     * Create a remote service proxy to talk to the server-side User Data  
     * service.  
     */  
    private final UserDataServiceAsync userDataService = GWT.create(UserDataService.class);  

    public ProfileWidget() {  

        this.rpcWidget = new RPCWidget(this);  

        this.initProfileImage();  
        this.initLogoImage();  

        panel.add(picSquare, DockPanel.WEST);  
        panel.add(html, DockPanel.CENTER);  

        VerticalPanel verticalPanel = new VerticalPanel();  
        verticalPanel.add(logo);  
        verticalPanel.add(logoutButton);  

        panel.add(verticalPanel, DockPanel.EAST);  

        panel.add(rpcWidget, DockPanel.SOUTH);  

        initWidget(panel);  

    }  

    private void initProfileImage() {  

        // Display ajaxLoader.gif  
        SandpitImageBundle sib = GWT.create(SandpitImageBundle.class);  
        AbstractImagePrototype aip = sib.ajaxLoader();  
        sib.applyTo(this.picSquare);  

    }  

    private void initLogoImage() {  

        // Display logo.jpg  
        SandpitImageBundle sib = GWT.create(SandpitImageBundle.class);  
        AbstractImagePrototype aip = sib.logo();  
        aip.applyTo(this.logo);  

    }  

    // Other methods omitted...  

}  

package org.redboffin.sandpit.client.icons;  

import com.google.gwt.user.client.ui.AbstractImagePrototype;  
import com.google.gwt.user.client.ui.ImageBundle;  

public interface SandpitImageBundle extends ImageBundle {  

    /**  
     * Would match the file 'logo.jpg', 'logo.gif', or 'logo.png' located in the  
     * same package as this type.  
     */  
    public AbstractImagePrototype logo();  

    /**  
     * Would match the file 'ajaxLoader.jpg', 'ajaxLoader.gif', or 'ajaxLoader.png' located in the
     * same package as this type.  
     */  
    public AbstractImagePrototype ajaxLoader();  

}  

我不明白为什么,但这现在起作用了,我没有做任何更改。

在您编译项目并将生成的war放入服务器公用文件夹之前,图像不会显示。您只是请求了一个不存在的文件