1-using JavaFX layouts (BorderPane, GridPane .... etc ...)
2-add some layout restrictions
You can use the scene builder to generate the FXML file and resize the screen to see what happens, see this tutorial for the layout
that is how you tell the program to draw your components based on constraints, so it will be an adaptive design, it will follow your constraints and automatically adjust the components.
source share