Panel layouts

I’m trying to place the “Objects” panel to the right in the panel “Hold” but it appears in the top left of the screen.

My panels are nested correctly (IMHO).

How do i solve this?

Code:
nifty.addScreen("start", new ScreenBuilder("start") {{ controller(new DefaultScreenController());
    layer(new LayerBuilder("foreground") {{
            childLayoutVertical();
            backgroundColor("#f000");
            
    
        panel(new PanelBuilder("Hold") {{
            childLayoutCenter();
            alignCenter();
            backgroundColor("#f408");
            width("1100px");
            height("700px");
        
       panel(new PanelBuilder("Item_Bar") {{
            childLayoutCenter();
            alignLeft();
            backgroundColor("#f408");
            width("800px");
            height("20px");
               text(new TextBuilder() {{
                text("right");
                font("Interface/Fonts/Default.fnt");
                height("100%");
                width("100%");
            }});
        }});
       
        panel(new PanelBuilder("Objects") {{
            childLayoutCenter();
            alignRight();
            backgroundColor("#108");
            width("299px");
            height("20px");
            
            text(new TextBuilder() {{
                text("right");
                font("Interface/Fonts/Default.fnt");
                height("100%");
                width("100%");
            }});
        }});
        //End background
    }});
        
        }});
}}.build(nifty));</div>

Result:(Look at the top left)
http://oi42.tinypic.com/4hcr9k.jpg

Perhaps you should try a horizontal layout, rather than the vertical you have now (vertical = from top to bottom, horizontal = from left to right).

2 Likes

It’s working. Thanks for the help.

Sorry but I have 1 (Hopefully) last problem.

How do you get panel to “wrap”.

They just keep going in a straight row and none of them move down to the next free space.

I’m looking at the tutorials but I can’t find a thing.

If you’re using a horizontal layout and want several rows, just put several horizontal layout panels inside a vertical layout panel and then put your content in the inner horizontal panels.

1 Like