I have an Hbox into which I upload images (more than one) in a loop. I'm trying to figure out their coordinates, but the layoutX of each of them = 0, as if they are at the same point (although everything is fine in the application as a result). Moreover, if after some interaction you add an image to another hbox, then its layout is displayed normally.
for (Card card:data.getCards()) {
ImageView imageView=new ImageView("imageSrc");
hbox.getChildren().add(imageView);
System.out.println(imageView.localToScene(new Point2D(0,0)));
System.out.println(imageView.getLayoutX());
}
result:
Point2D [x = 124.0, y = 225.0]
0.0
Point2D [x = 124.0, y = 225.0]
0.0
Point2D [x = 124.0, y = 225.0]
0.0
how do I determine the object's coordinate in this case?