As the title basically. I have a node in JavaFX which I want to be displayed in front of all other nodes according to certain CSS rules. I do not want this to change the ordering of the nodes in my VBox which .toFront() appears to do. See this question.
Is this even possible?
EDIT: To clarify. The situation is the following. I have a VBox containing a bunch of tightly packed ImageViews. When I hover over one I want it to grow slightly to give it the feel that the image is being lifted off of the screen. But since the ImageViews are so tightly packed only the top edge grows (visibly). The bottom edge grows but is below the following image and cannot be seen.
EDIT 2: Upon request here is a screenshot of what I am doing.
The different colour gradients are ImageViews and as I hover over one it should grow as the top edge of the top gradient has in this image (look closely at the top right corner next to the X). However as is also visible in this image the bottom edge of this ImageView has become hidden by the next gradient in this VBox and the grow is not visible.

This sounds like the perfect situation for using the
viewOrderproperty ofNodeadded in Java 9. TheviewOrdercontrols howNodes are drawn in relation to otherNodes of the sameParentwithout changing the order of theNodes in the child list. Here's the Javadoc:Here's an example using this property:
It uses
Rectangles instead ofImageViews but the concept is the same. When the mouse hovers over aRectangleit sets the view order to be lower than the others and then plays aScaleTransitionto make it bigger. When the mouse exits it resets the view order back to0and then reverses theScaleTransition.Note: I used the
varkeyword which was added in Java 10.And here is a GIF of the example in action:
Edit: Since you brought up CSS I went and checked if the view order could be set from a stylesheet. And it appears it can. Looking at the CSS Reference Guide there is a CSS property defined for
Nodenamed-fx-view-order.