I have a JavaFX BorderPane in which I add an ImageView as the center node of the BorderPane. The ImageView becomes very big, and overlapsed other nodes.
I want to set the dimensions of the ImageView programmatically for the case that the user resizes the window, so I thought I can use Bindings.
public class MainController implements FxController {
private ImageView videoImageView;
@FXML
BorderPane borderPane;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
this.videoImageView = new ImageView();
this.videoImageView.setPreserveRatio(true);
videoImageView.fitWidthProperty().bind(borderPane.widthProperty());
videoImageView.fitHeightProperty().bind(borderPane.heightProperty());
borderPane.setCenter(videoImageView);
}
}
The problem is that the used properties deliver the full width and height of the whole BorderPane. How can I assign the whole available space of the center node to the ImageView and how can the ImageView be responsive using Bindings?