I wanted to resize an image so it fits into the entire left region of a borderpane, but I don't understand the different regions of a borderpane. Do they all have the same dimensions? The code below I added a pane to the left region but I honestly don't really understand the automatic resizing of the regions depending of the size of the nodes added to it. Some pointers in the right direction would be nice. Also, this controller class is used to add a slideshow of images that fade in and fade out on a timer.
public class Controller implements Initializable {
@FXML public ImageView current;
public ImageView next;
@FXML public BorderPane borderPane;
@FXML public Button nextButton = new Button();
static int count = 0;
@FXML public Pane pane;
ArrayList<Image> imagesArrayList = new ArrayList<>();
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
imagesArrayList.add(new Image("/sample/pictures/download.jpg"));
imagesArrayList.add(new Image("/sample/pictures/images.jpg"));
imagesArrayList.add(new Image("sample/pictures/klepiahzwl921.png"));
borderPane.setPrefSize(450, 450);
pane.setPrefSize(borderPane.getPrefWidth(), borderPane.getPrefHeight());
current.fitWidthProperty().bind(pane.prefWidthProperty());
current.fitHeightProperty().bind(pane.prefHeightProperty());
Timeline timeline = new Timeline();
KeyValue transparent = new KeyValue(current.opacityProperty(), 0.0);
KeyValue opacity = new KeyValue(current.opacityProperty(), 1.0);
KeyFrame startFadeIn = new KeyFrame(Duration.ZERO, transparent);
KeyFrame endFadeIn = new KeyFrame(Duration.seconds(5), opacity);
KeyFrame startFadeOut = new KeyFrame(Duration.seconds(5), transparent);
KeyFrame endFadeOut = new KeyFrame(Duration.seconds(5.0), e ->{
count++;
current.setImage(imagesArrayList.get(count % 3));
}, transparent);
timeline.getKeyFrames().addAll(startFadeIn, endFadeIn, startFadeOut, endFadeOut);
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
}