Flippy Flippy - 22 days ago 5
Java Question

JavaFX StackPane get Item in Front

as the title says, I'm using a StackPane where I stack my AnchorPanes(

AnchorPaneName.setFront()
). I want to know which AnchorPane is on top/in front. Is it possible to get the AnchorPane which is in Front?

Answer

The front one will be the last item in the parent's child list, i.e. call

getChildren().get(getChildren().size()-1)

on the parent (the StackPane, if I understand your question correctly).

Comments