I created a FXML with fx:root construct and put on it for example ImageView image; The root AnchorPane has 500 x 500 dimension, and that image located in a center 250 x 250 and has width = 50 and height = 50. I can see all bounds and cooridnates in Scene Builder.
Then i need to do some calculation in a constructor based on image Width\Height and X, Y; But all of them are equals to zero.
As i understood all layouts are invalid until my component is placed into some other parent container of stage and after stage.show() method. But i need to do calculations based just on initial FXML of a component.
I found 2 ways.
The first is to surround them into Platform->runLater():
But i'm sure that this is a wrong approach, because i have to put all initialisation component logic (positioning, transitions and so on) inside that thread.
The second way is to create a method with that calculations and execute it after parent stage initialized ShellForm.Shell.SOME_INIT_METHOD();
That also seems to be wrong, because i have to control initialization of component inner structure outside that component.
How can i get a correct dimensions of those "child" components in a constructor of my FXML component?