Can shrink window
This commit is contained in:
@@ -113,9 +113,19 @@ public class FXMediaController implements MediaController {
|
||||
});
|
||||
|
||||
bindPlayButton();
|
||||
|
||||
stackPane.widthProperty().addListener((observable, oldValue, newValue) -> resizeMediaView());
|
||||
stackPane.heightProperty().addListener((observable, oldValue, newValue) -> resizeMediaView());
|
||||
binder.createBindings();
|
||||
}
|
||||
|
||||
private void resizeMediaView() {
|
||||
final var width = stackPane.getWidth();
|
||||
final var height = stackPane.getHeight();
|
||||
videoView.setFitWidth(width);
|
||||
videoView.setFitHeight(height);
|
||||
}
|
||||
|
||||
private void loadFileVideo(final Path fileVideoPath) {
|
||||
final var media = new Media(fileVideoPath.toUri().toString());
|
||||
final var player = new MediaPlayer(media);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<center>
|
||||
<StackPane fx:id="stackPane">
|
||||
<children>
|
||||
<MediaView fx:id="videoView" fitHeight="${stackPane.height}" fitWidth="${stackPane.width}"/>
|
||||
<MediaView fx:id="videoView" managed="false"/>
|
||||
</children>
|
||||
</StackPane>
|
||||
</center>
|
||||
|
||||
Reference in New Issue
Block a user