Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Anchor Pane constrains in javafx code?

Tags:

java

javafx

I know that you can add Anchor Pane contains in fxml like:'AnchorPane.bottomAnchor="0.0"' but can you set AnchorPane constrains in java code?

like image 569
sazzy4o Avatar asked Jan 30 '15 22:01

sazzy4o


1 Answers

There are a set of static methods on AnchorPane which you call with the node and the constraint.

  • AnchorPane.setTopAnchor(Node, double)
  • AnchorPane.setBottomAnchor(Node, double)
  • ... etc.

Example

AnchorPane.setBottomAnchor(button, 0.0);
like image 131
Adam Avatar answered Sep 30 '22 00:09

Adam