tags:

views:

218

answers:

1

I am trying to make GUIs in SWT using Jigloo and when I want to set images to Labels or Buttons, I can see them in the preview pane. However, when i compile and run it, it throws

SWTResourceManager.getImage: Error getting image img/game/front/test.png, java.lang.IllegalArgumentException: Argument cannot be null

The code it generates looks like this:

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"));

The SWTResourceManager class seems to be largely undocumented so I'm kinda lost here. Any help?

+1  A: 

This method requires an absolute path,

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