Adding panels and stuff to a xml GUI

Okey, here is what I am trying to do. I read a standard layout from xml and then, by code, adding a new layer with a panel on it. However I have no idea how I am supposed to do that, this is the code that should add a new layer:

public class TestScreen implements ScreenController {

public void bind(Nifty nifty, Screen screen) {

new LayerBuilder(“layer”)



panel(new PanelBuilder() {{







}}.build(nifty, screen, screen.getRootElement());


public void onStartScreen() {


public void onEndScreen() {



Okey, I got it to work now, I have updated the code as well. But I can’t see the panel. Can anyone help me?

After creating that new layer you have to call “screen.layoutLayers()”. This looks like a bug.