Issue
i'm struggling with a vertical box i added a transition to, it stays at the back of the other nodes like label and imageview. i tried using toFront() but it didn't work. also i tried using .setStyle("-fx-view-order: [number]") but i was lost a bit in what the numbers represent exactly is it the order of nodes ascending or descending.
#1
vb.setStyle("-fx-view-order: 0");
img.setStyle("-fx-view-order: 1");
didn't work
#2
vb.setStyle("-fx-view-order: 1");
img.setStyle("-fx-view-order: 0");
didn't work
Solution
The easiest way to get a Node to render on top is to move it to the end of the child node list for its parent Node.
Note the documentation for -fx-view-order mentions: "The parent traverses its children in decreasing viewOrder order." To me that means higher view order is behind (drawn first) relative to lower view order. However, this is all relative to the parent node, not the Scene. Give us a reproducible example of what you are doing.
Also, what version of JavaFX are you using? -fx-view-order was not in JavaFX 8 (JDK 8) https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#node
Answered By - swpalmer
Answer Checked By - Mildred Charles (JavaFixing Admin)