Thanks for your reply. 
I´ve tried the way using “nElement.getControl(WindowControl.class).getContent()”, but everything is centered now. I also have no option to set the childLayout of the content panel.
Yes, I´ve tried to use the closeable method, but it´s not working.
I also get the mentioned error message if I close the window.
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker callMethod
Warnung: RuntimeException: java.lang.IllegalArgumentException: wrong number of arguments
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: sun.reflect.NativeMethodAccessorImpl invoke0 (NativeMethodAccessorImpl.java:-2)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: sun.reflect.NativeMethodAccessorImpl invoke (NativeMethodAccessorImpl.java:57)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: sun.reflect.DelegatingMethodAccessorImpl invoke (DelegatingMethodAccessorImpl.java:43)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: java.lang.reflect.Method invoke (Method.java:606)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.NiftyMethodInvoker callMethod (NiftyMethodInvoker.java:145)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.NiftyMethodInvoker performInvoke (NiftyMethodInvoker.java:104)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.Nifty$DelayedMethodInvoke perform (Nifty.java:1174)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.Nifty invokeMethods (Nifty.java:1152)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.Nifty handleDynamicElements (Nifty.java:354)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.Nifty access$1700 (Nifty.java:77)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processEvent (Nifty.java:1374)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processMouseEvent (Nifty.java:1329)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.niftygui.InputSystemJme handleMouseEvent (InputSystemJme.java:124)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.niftygui.InputSystemJme onMouseButtonEventQueued (InputSystemJme.java:232)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.niftygui.InputSystemJme forwardEvents (InputSystemJme.java:296)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: de.lessvoid.nifty.Nifty update (Nifty.java:288)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.niftygui.InputSystemJme endInput (InputSystemJme.java:113)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.input.InputManager processQueue (InputManager.java:819)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.input.InputManager update (InputManager.java:883)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.app.Application update (Application.java:604)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.app.SimpleApplication update (SimpleApplication.java:231)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.system.lwjgl.LwjglAbstractDisplay runLoop (LwjglAbstractDisplay.java:151)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.system.lwjgl.LwjglDisplay runLoop (LwjglDisplay.java:185)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: com.jme3.system.lwjgl.LwjglAbstractDisplay run (LwjglAbstractDisplay.java:228)
Okt 29, 2014 10:09:58 PM de.lessvoid.nifty.NiftyMethodInvoker logException
Warnung: java.lang.Thread run (Thread.java:744)
parentLayer = screenTest.findElementByName("HUD-Layer2");
windowBuilder = new WindowBuilder();
windowBuilder.closeable(false);
windowBuilder.id("HUD-Economy-Main" + idCountMain);
windowBuilder.height("70%");
windowBuilder.width("50%");
windowBuilder.x(positionX + "px");
windowBuilder.y(positionY + "px");
windowBuilder.childLayoutVertical();
windowBuilder.style("nifty-window");
windowBuilder.build(nifty, screenTest, parentLayer);
idCountMain++;
windowContentPanel = screenTest.findElementByName("HUD-Economy-Main" + (idCountMain-1));
windowContentID = windowContentPanel.getControl(WindowControl.class).getContent().getId();
parentPanel = screenTest.findElementByName(windowContentID);
createPanel1 = new PanelCreator();
createPanel1.setId("HUD-Economy-Content" + idCountContent);
createPanel1.setHeight("20%");
createPanel1.setWidth("100%");
createPanel1.setBackgroundColor("#f00f");
createPanel1.setChildLayout("center");
createPanel1.setStyle("nifty-panel-simple");
createPanel1.create(nifty, screenTest, parentPanel);
idCountContent++;
Update: I found a solution for the childLayout. I had to add another panel. On void´s page there´s an entry about this:
“Please Note: By default windows use a CenterLayout for the content. So make sure that you add a panel with another childLayout if you plan to have several elements/controls in your window.”
Update 2: I found a way to solve the other problem, too. I use the DraggableBuilder (https://github.com/void256/nifty-gui/wiki/Drag’n’Drop) including a close “button”.