The article will provide a user with information on AnchorPane. The AnchorPane layout pane enables a user to anchor nodes to the top, bottom, left side, right side, or center of the pane. As the window is resized, the nodes maintain their position relative to their anchor point. Nodes can be anchored to more than one position and more than one node can be anchored to the same position.
Let’s see how to create an anchor pane with a node anchored to the top of the pane and a node anchored to the bottom right of the pane.
AnchorPane anchorpane = new AnchorPane();
Button buttonSave = new Button(“Save”);
Button buttonCancel = new Button(“Cancel”);
HBox hbox = new HBox();
hbox.setPadding(new Insets(0, 10, 10, 10));
anchorpane.getChildren().addAll(grid,hbox); // Add grid from Example 5
As the window is resized, the nodes maintain their position in the pane according to their anchor points.
If a user has read the article then he/she would have learnt about anchor pane and also how to create an anchor pane.