Drawing a border around a JavaFX Text node

Viewed 17757

I want to draw red borders around arbitrary javafx.scene.text.Text nodes in my JavaFX scenegraph, for example those in a Button object.

It is easy to retrieve all the Text nodes but not to find where they are in the scene, they have an x and y property which doesn't seem to get set properly but they do not have a width and height.

So far I have tried to add rectangles with a red stroke to a stack pane but the x and y are always wrong and I can't get the size.

1 Answers
Related