How to set margin between two components while use the AttachtoComponent function?

I have a button that set in center of the screen and one Label that set at top of that button. I am able to do it but Label and button has the 0 margin. i want to set the 10px margin between them.

this is my label attached button
lbllowest.attachToComponent(&buttonA3, false);

this is my Button bound property

Rectangle buttobound(0, 0, 200, 80);
buttobound.setCentre(getLocalBounds().getCentre());
buttonA3.setBounds(buttobound.removeFromLeft(buttobound.getWidth() / 2));
buttonC5.setBounds(buttobound);

Can you please help me out?

You’ll have to do it the hard way, with setBounds()

position your label first, then do:

int margin = 10; //or whatever margin you want.
button.setBounds( label.getX(), label.getBottom() + margin, buttonWidth, buttonHeight );

Yes that the way. But i want to set the button at center and at top of button (margin=10), i want to set the text Now i got this. Thank You sir

Sir can you please let me how to set the three icon at bottom of the screen with space arround? below is my link

https://stackoverflow.com/questions/61379818/how-to-set-the-icon-at-bottom-of-the-screen-in-single-row-in-juce

use the setBounds() function to position your components.
There are a bunch of helper functions you can use to position them within your parent component’s bounds.
JUCE: Component Class Reference Scroll down to where the ‘getX()’ function is and look through the available options.
you’ll do stuff like

auto componentBounds = getLocalBounds();
button1.setBounds(componentBounds.getX() + 10, //left edge + 10 px
                  componentBounds.getBottom() - preferredHeight,
                  preferredWidth,
                  preferredHeight);
//adjacent to button1, with same bounds, and a 10px gap
button2.setBounds( button1.getBounds().withX( button1.getRight() + 10 ) );

Good luck

Thank You matkatmusic