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”)

{{

childLayoutCenter();



panel(new PanelBuilder() {{

id(“panel”);

childLayoutCenter();

backgroundColor("#640000");

height(pixels(200));

width(pixels(400));

}});

}}.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.