Positioning an image using Nifty

Hi guys.

I’m using nifty for my GUI (Java, not XML). I have two images. One, I want to display in the centre of the screen. I have done this. However I have a second image I want to be in the centre of the screen on the Y Axis, but on the left side of the screen for X (aka X=0). No matter what I change, the second image appears in the middle of the screen. Help!

Current Nifty code:

[java]layer(new LayerBuilder(“Layer”) {
{
childLayoutCenter(); // layer properties, add more…

                    // <panel>
                    panel(new PanelBuilder("Panel") {
                        {
                            childLayoutCenter(); // panel properties, add more...               

                            // add image
                            image(new ImageBuilder() {
                                {
                                    filename("Interface/open.png");
                                    childLayoutCenter();
                                }
                            });
                            
                            //.. add more GUI elements here              

                        }
                    });
                    
                     panel(new PanelBuilder("Panel1") {
                        {
                            childLayoutVertical(); // panel properties, add more...               

                            // add image
                            image(new ImageBuilder() {
                                {
                                    alignLeft();
                                    valignCenter();
                                    filename("Interface/open2.png");
                                    //childLayoutCenter();
                                }
                            });
                            
                            //.. add more GUI elements here              

                        }
                    });
                    // </panel>
                }
            });
            // </layer>[/java]

it looks like this:

I need the “Swansea university virtual campus” window on the left.

Thanks!

The problem is in the second panel you need to set alingLeft() on it not in the Image inside. Have a look here :
[java]

panel(new PanelBuilder(“Panel1″) {
{
childLayoutVertical(); // panel properties, add more…
alignLeft();
// add image
image(new ImageBuilder() {
{

                                    valignCenter();
                                    filename(“Interface/open2.png”);
                                    //childLayoutCenter();
                                }
                            });

                            //.. add more GUI elements here              

                        }
                    });

[/java]
I also suggest if you are nifty-gui beginner to try my nifty-editor to get use of nifty layout :slight_smile: . Moreover now that new release is almost ready :slight_smile:

Thanks for that, worked 100%!