I have three buttons in a row in an anchorpane. When i resize the pane I would like the middle button to move proportionally (left/right, up/down) without changing size. How would I set the anchors to do this?
On a related issue, how can I restrict the anchorpane to movement in only one plane (up/down or right/left)?
In the Designer:
Place the Three buttons on AnchorPane.
Select the Three Buttons
Click Arrange in the Menu.
Select Wrap In GridPane
Size the GridPane on the AnchorPane
Select each button and put in its Width and Height and Text in the Properties Section
Also put in the ID for each button
Select the GridPane and under Layout Click the Left and Right Constraints
This keeps the GridPane the same width as theOverall Pane.
Select the Left Button and in the Layout select the Halignment and select LEFT.
Select the Center Button and in the Halignment select CENTER
Select the Right Button and in the Halignment select RIGHT.
Click Preview in the Menu.
Select Show Preview in Window.
Re-size the Form and notice the Buttons change Position.
Code attached
You should be able to work out the rest from here.