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