I currently have a scrollpane that is included in an HBox Node and set with HBox.setHgrow(scrollpane, Priority.SOMETIMES);
Also, I have manually set the dimensions of this scrollpane through using:
scrollpane.setPrefWidth(w);
scrollpane.setMaxWidth(mxw);
scrollpane.setMinWidth(mnw);
Having all this set, the pane is displayed as required in its parent node, and when no other nodes are within the parent HBox, the scrollpane occupies the whole space.
When I attempt to get the width of this scrollpane, I am unable to get the calculated with, and all the values seem to return 0; I have attempted the following methods in order to obtain the real with:
scrollpane.getWidth(); // returns 0
scrollpane.getLayoutBounds.getWidth(); // returns 0
scrollpane.boundsInLocalProperty().get().getWidth; // returns 0
scrollpane.boundsInParentProperty().get().getWidth; // returns 0
scrollpane.widthProperty().get(); // returns 0
scrollpane.layoutBoundsProperty().get().getWidth(); // returns 0
I have also used scenicView v8.0.0 to check the actual value of the width (which is different from prefWidth), but I cannot seem to recover this value anywhere from the available methods on Scrollpane.
I am not quite sure what I am missing here.
Any help solving this would be greatly appreciated.