Piet is correct about using the AnchorPane.setTopAnchor()
static method reference.
You CAN access the static method on AnchorPane via a AnchorPane instance reference, but it's considered a bad practice.
I would say for the following reasons (at least):
-It harms readability (it looks like calling a regular instance method so it's misleading).
-It's more fragile - you're required to have an instance reference. If the AnchorPane reference you're calling the method on is null, you'll get an NPE. A static method reference won't NPE like that (unless you pass a null parameter maybe).
Hopefully your IDE warns you - don't ignore warnings. IntelliJ's warning about this:
So use this form:
AnchorPane.setTopAnchor(someChildComponentInstance, 10.0);
So:
There's a few other times you use these static methods in JFX too, notably VBox.setVgrow() and HBox.setHgrow(), and I think a few others. They're really important for doing anything other than trivial layouts in JFX. Although if you use SceneBuilder (strongly suggested), you rarely need to worry about these.