If you are using JavaFX then it is worth knowing that the definitive way to get size and position information for a Pane is to use
Bounds bounds = pane.boundsInParent().get();
The Bounds object obtained gives width, height and translated position (minX, minY) for this pane in its parent. Even if the width of a pane is set it may get overridden by the layout if there is insufficient room. Therefore, you cannot rely on what you think the size is. Instead use the bounds above to get the actual answer.
No comments:
Post a Comment