2009-09-05 62 views
0

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

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类似乎主要无证所以我有点失去了这里。任何帮助?

回答

1

这种方法需要的绝对路径,

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