0

I am trying to add an image as child to a StackPane. For some reason I can't do it directly so what I do instead is create a Label and then add it. However, the image is really big so I try to scale it down the size of the StackPane by binding it. This also doesn't work and the image displayed is still not scaled down. Any ideas how to fix this?

...
StackPane square = new StackPane();
Label Queen = new Label();
Queen.setGraphic(new ImageView(queen));
Queen.prefHeightProperty().bind(square.heightProperty());
Queen.prefWidthProperty().bind(square.widthProperty());

//Only want to show the image inside a particular StackPane
if(row == posRow && col == posColumn) 
    square.getChildren().add(Queen);
...
Meta Xenology
  • 142
  • 2
  • 9

0 Answers0