Lmur gui how to set position set size set window size?

Hello i learn lemur gui
GitHub - jMonkeyEngine-Contributions/Lemur: Lemur is a jMonkeyEngine-based UI toolkit.

 Exaple: 
    / Initialize the globals access so that the defualt
    // components can find what they need.
    GuiGlobals.initialize(this);
        
    // Load the 'glass' style
    BaseStyles.loadGlassStyle();
        
    // Set 'glass' as the default style when not specified
    GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");

    // Create a simple container for our elements
    Container myWindow = new Container();
    guiNode.attachChild(myWindow);
        
    // Put it somewhere that we will see it
    // Note: Lemur GUI elements grow down from the upper left corner.
    myWindow.setLocalTranslation(320, 320, 10);

    // Add some elements
    myWindow.addChild(new Label("Hello, World."));
    Button clickMe = myWindow.addChild(new Button("Click Me"));
    Button clickMe2 = new Button("");
    clickMe2.setSize(new Vector3f(0.5f, 0.5f, 0.5f));
    
    myWindow.addChild(clickMe2);
    clickMe.addClickCommands(new Command<Button>() {
            @Override
            public void execute( Button source ) {
                System.out.println("The world is yours.");
            }
        });            

How to resize window? setLocalTranslation not working
How to set button size? setSize(new Vector3f(5, 5, 5)); not working
How to set button position on windows? i need squeare 3x3

Hi

You cas use setPreferedSize().

The position is handled by the layout. By default Container uses SpringGridLayout which uses a grid. You can set the position of the child when adding it to the container.

1 Like

Also, note that you are trying to set you button to be half a pixel wide.

1 Like