Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.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
Java 在Jigloo中设置图像时出现IllegalArgumentException_Java_User Interface_Swt - Fatal编程技术网

Java 在Jigloo中设置图像时出现IllegalArgumentException

Java 在Jigloo中设置图像时出现IllegalArgumentException,java,user-interface,swt,Java,User Interface,Swt,我正在尝试使用Jigloo在SWT中创建GUI,当我想将图像设置为标签或按钮时,我可以在预览窗格中看到它们。然而,当我编译并运行它时,它抛出 SWTResourceManager.getImage: Error getting image img/game/front/test.png, java.lang.IllegalArgumentException: Argument cannot be null 它生成的代码如下所示: opIcon = new Label(this, SWT.NON

我正在尝试使用Jigloo在SWT中创建GUI,当我想将图像设置为标签或按钮时,我可以在预览窗格中看到它们。然而,当我编译并运行它时,它抛出

SWTResourceManager.getImage: Error getting image img/game/front/test.png, java.lang.IllegalArgumentException: Argument cannot be null
它生成的代码如下所示:

opIcon = new Label(this, SWT.NONE);
FormData opIconLData = new FormData();
opIconLData.width = 64;
opIconLData.height = 64;
opIconLData.left =  new FormAttachment(0, 1000, 12);
opIconLData.top =  new FormAttachment(0, 1000, 12);
opIcon.setLayoutData(opIconLData);
opIcon.setImage(SWTResourceManager.getImage("img/game/front/test.png"));

SWTResourceManager类似乎基本上没有文档记录,所以我在这里有点迷路了。有什么帮助吗?

此方法需要绝对路径

SWTResourceManager.getImage("/home/img/game/front/test.png");