JavaFx 2.0: Controlling the Z-Order of Stage elements


Question

JavaFx 2 has built in a couple methods for controlling z-order but they are not very fine grained. You can call toFront() or toBack(). But what if you want to insert a visual element, say, right above level 4?

1
5
5/5/2012 9:18:54 PM

You may achieve it by getting the children ObservableList of the parent node and manipulate them, for instance by add(int index, Node element):

parent.getChildren().add(4, visualElement);

AFAIK toFront() and toBack() are working in the same manner.

3
5/5/2012 9:55:59 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon