[Nifty + jme3] Error with multiple controls in a panel

Whenever I attempt to add a second, third, etc., control to a panel, every control other than the first is displayed in the upper left of the screen.This occurs with every combination of control I have tried so far. I’ve had the same problem on two separate computers, so I doubt it’s installation related. My jMonkeyPlatform is updated. Here is a screenshot: http://i.imgur.com/9Xj1F.png



Here’s my Nifty xml.

[xml]

<nifty >

<useStyles filename=“nifty-default-styles.xml” />

<useControls filename=“nifty-default-controls.xml” />

<screen id=“start”>

<layer id=“layer” backgroundColor="#000000" childLayout=“center”>

<panel backgroundColor="#123" id=“bgPanel” height=“80%” width=“80%” align=“center” valign=“center” style=“nifty-panel-simple” childLayout=“center” visibleToMouse=“true”>

<control align=“left” valign=“top” id=“sliderV” name=“verticalSlider” height=“100px” />

<control align=“right” valign=“bottom” id=“sliderH” name=“verticalSlider” height=“100px” />

</panel>

</layer>

</screen>

</nifty>

[/xml]



Thanks, and I would be happy to provide any other source.

I think childLayout=“center” is your problem, maybe. I’m a nifty noob as well but I think if you want more than one component the parent has to have childLayout as vertical or horizontal.

Perfect. Thanks!

childLayout=“center” is special. it currently only supports a single child element if you add more child elements to it it will explode :smiley:



you’ll need to add a panel child:



[xml]<panel childLayout=“center” …

<panel align=“center” valign=“center” childLayout=“vertical” …

<control name=“verticalSlider” …

<control name=“verticalSlider” …

</panel>

</panel>[/xml]



so you basically add a “helper” panel that acts as the container for its child elements and itself is centered in its parent panel.