Absolute positioning with Lemur

I want to create a composite widget that looks like the mock up below. There are multiple labels and images, positioned and spaced with absolute coordinates.

I’ve tried to achieve it with this code.

    ActionButton replayReroll = new ActionButton(new CallMethodAction(null, this, "scene"), new ElementId("mission-replay.button"));//"", new Quad(83, 30));

        mainMission.setPreferredSize(new Vector3f(450, 68, 0));
        mainMission.setInsetsComponent(new DynamicInsetsComponent(0.5f, 0, 0.5f, 0));
        mainMission.setLocalTranslation(190, 130, 0);
        attachChild(mainMission);
        label.setPreferredSize(new Vector3f(450, 68, 0));
        label.setInsetsComponent(new DynamicInsetsComponent(0.5f, 0, 0.5f, 0));
        label.setLocalTranslation(200, 100, 0);
        attachChild(label);

        replayReroll.setPreferredSize(new Vector3f(83, 30, 0));
        replayReroll.setLocalTranslation(600, 100, 0);
        //replayReroll.setMaterial(mMissionReplay);
        addChild(replayReroll);



selector( "mission-replay", "button", "amethyst" ) {
    background = defMissionReplay
    //color = pinkColor
    //highlightColor = blackColor
    //focusColor = blackColor
    //disabledColor = grayColor
    insets = new Insets3f( 2, 2, 2, 2 );
    buttonCommands = replayButtonCommands;
}

…but the replayReroll button is placed below the box. How can I put it inside the box?

EDIT: The code don’t fit exactly the above screenshot, but it’s an example of layout with absolute positioning

What are we addChild()ing to? Or did you mean to attachChild() instead?

The box is a Container and I’m adding everything inside.
So basically a Container which includes Labels and Buttons positioned with absolute coordinates, and themed with groovy

But some of the things you are using attachChild() (ie: not using the container’s layout) and the button that is misbehaving is using addChild() (ie: is using the container’s layout).

…thought maybe that was the issue. Is there a reason you are using two different approaches or is it a typo?

Edit: incidentally, I don’t think the insets will do anything if the child is not managed by a layout.

WIth attachChild the button is not visible, so I used addChild which made it visible

Weird that the other ones are visible…

What Lemur needs in these cases is a NullLayout that just calculates its bounds from what the children tell it directly and doesn’t push anything down. It probably wouldn’t be hard to write on if you chose to give it a try.

With a little bit extra, it could even support the insets of the children.

So somebody has done something that resemble this?

This is what I did, and I don’t have idea on what to do next…

    class NullLayout extends GuiLayout{

        @Override
        public <T extends Node> T addChild(T n, Object... constraints) {
            return null;
        }

        @Override
        public void removeChild(Node n) {

        }

        @Override
        public Collection<Node> getChildren() {
            return null;
        }

        @Override
        public void clearChildren() {

        }

        @Override
        public void calculatePreferredSize(Vector3f size) {

        }

        @Override
        public void reshape(Vector3f pos, Vector3f size) {

        }

        @Override
        public void attach(GuiControl parent) {

        }

        @Override
        public void detach(GuiControl parent) {

        }

        @Override
        public boolean isAttached() {
            return false;
        }

        @Override
        public GuiControl getGuiControl() {
            return null;
        }

        @Override
        public GuiLayout clone() {
            return null;
        }
    }

I guess adding an ArrayList for adding and removing Nodes. But then?

As far as I know, no one has made one yet… or if they have they didn’t post it (that I’m aware).

…even though I called it a “Null” layout, it will actually have to do some work. You might be able to start with one of the other simpler layouts (like BoxLayout) and rip things out of it.

Edit: you could also poke a little into why some of your stuff works with attachChild() and one thing doesn’t. Because that’s not right, either.

Edit 2: and maybe a hack is to just add another empty thing with addChild() like a blank label or something and then convert that button back to attachChild().