Nifty gui: panel background image vs image

Hi,



is there any significant difference between using an image or a panel with backgroundImage in the nifty gui ?

What would you suggest to use and why ?

I use for example a ‘backgroundImage’ in my WindowBuilder, like this:



[java]

panel(new PanelBuilder(“winOC_Element”) {{

childLayoutAbsolute();

controller(new OperatorControl());

control(new WindowBuilder(“winOperatorControl”, “Operator”) {{

backgroundImage(panelBackgroundImage);



[/java]



and also in my java class controller I can change this background image, with some code, like this: (this is the backgroundImage for a button, but I guess it is the same for a windowBuilder, because both are ‘elements’



[java]

screen.findElementByName(nameButton).getRenderer(ImageRenderer.class).setImage(nifty.createImage(buttonActive, false));

[/java]



:slight_smile:

I hope it helps you.

1 Like

If you are putting other things inside it, use a panel. If not, use an image :slight_smile: