Java 在Jigloo中设置图像时出现IllegalArgumentException
我正在尝试使用Jigloo在SWT中创建GUI,当我想将图像设置为标签或按钮时,我可以在预览窗格中看到它们。然而,当我编译并运行它时,它抛出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
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");