Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+15 votes

How do I adjust the position of a Button in scene builder ? I tried to change the alignment, didn't work. I put some random numbers in padding which changed the size of the button but not the position.

asked in CSC305 Fall 2022 by (1 point)

2 Answers

+6 votes

The alignment property of the Button adjusts the alignment of the content within the button. To adjust the alignment of the button, you adjust the alignment property of the container the button is in.

answered by (1 point)
+6 votes

Padding refers to space inside of the component, whereas Margins refer to space outside/around the component. Thus, you might have more luck changing the margins than the padding.

However, keep in mind that the position of a node is also quite affected by the Parent node that it's in. For example, if it's in a VBox or HBox, then the Alignment property of that box also affects whether the things inside of the box are centered, or aligned left/right, etc.

And naturally different layouts (BorderPane, AnchorPane, GridPane, etc.) may have different configurations/options as well.

answered by (5.7k points)
...