How to make mediaView appear always at the center of BorderPane in JavaFX?

177 Views Asked by At

I need media view at the center of border pane but non of the BorderPane.setMargin or BorderPane.setAlignment are working.Screenshot of my app

MediaView mediaView = new MediaView();
Media media = new Media("file:/E:/video.mp4");
MediaPlayer mediaPlayer = new MediaPlayer(media);
mediaView.setMediaPlayer(mediaPlayer);
mediaView.fitWidthProperty().bind(video_BorderPane.widthProperty());    

BorderPane.setMargin(mediaView, new Insets(100,100,100,100));
BorderPane.setAlignment(mediaView, Pos.CENTER);

video_BorderPane.getChildren().addAll(mediaView);
0

There are 0 best solutions below