always when i try to get the width of an Array in Java it just returns 0 and i dont know why. Can somebody explain to me how it is done right?
To get the width you need to call prefWidth(-1) and prefHeight(-1) the layout bounds are only set once the control is layouted through resizeRelocate
To get the correct width before the stage is shown you also need to call impl_processCSS(true) which is an NONE public API but there's nothing better at the moment IIRC
HBox h = new HBox();
Label l = new Label("Hello");
h.getChildren().add(l);
Scene s = new Scene(h);
l.impl_processCSS(true);
System.err.println(l.prefWidth(-1)+"/"+l.prefHeight(-1));