List of usage examples for javafx.beans.property DoubleProperty bind
void bind(ObservableValue<? extends T> observable);
From source file:Main.java
@Override public void start(Stage primaryStage) { String workingDir = System.getProperty("user.dir"); final File f = new File(workingDir, "../media/omgrobots.flv"); final Media m = new Media(f.toURI().toString()); final MediaPlayer mp = new MediaPlayer(m); final MediaView mv = new MediaView(mp); final DoubleProperty width = mv.fitWidthProperty(); final DoubleProperty height = mv.fitHeightProperty(); width.bind(Bindings.selectDouble(mv.sceneProperty(), "width")); height.bind(Bindings.selectDouble(mv.sceneProperty(), "height")); mv.setPreserveRatio(true);/*from w w w .jav a 2 s .c o m*/ StackPane root = new StackPane(); root.getChildren().add(mv); final Scene scene = new Scene(root, 960, 540); scene.setFill(Color.BLACK); primaryStage.setScene(scene); primaryStage.setTitle("Full Screen Video Player"); primaryStage.setFullScreen(true); primaryStage.show(); mp.play(); }