From e8b23c3f7af207139b0c58190d379d89134e1b81 Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Tue, 3 Feb 2015 01:08:11 -0600 Subject: [PATCH] Viewport now scales with window seamlessly -- though the emulator is still unusable in this state, this shows how fast the video scaling is in JavaFX compared to Swing. --- src/main/java/jace/JaceUIController.java | 15 +++++++++++---- src/main/resources/fxml/JaceUI.fxml | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/jace/JaceUIController.java b/src/main/java/jace/JaceUIController.java index b21413b..04bbc83 100644 --- a/src/main/java/jace/JaceUIController.java +++ b/src/main/java/jace/JaceUIController.java @@ -7,10 +7,12 @@ package jace; import jace.core.Video; +import java.net.URL; import javafx.scene.canvas.Canvas; import java.util.ResourceBundle; import javafx.fxml.FXML; import javafx.scene.image.ImageView; +import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Region; /** @@ -19,19 +21,24 @@ import javafx.scene.layout.Region; */ public class JaceUIController { @FXML - private ResourceBundle resources; + private URL location; + + @FXML + private AnchorPane rootPane; @FXML private Region notificationRegion; - + @FXML private ImageView appleScreen; - @FXML - public void initialize() { + void initialize() { + assert rootPane != null : "fx:id=\"rootPane\" was not injected: check your FXML file 'JaceUI.fxml'."; assert notificationRegion != null : "fx:id=\"notificationRegion\" was not injected: check your FXML file 'JaceUI.fxml'."; assert appleScreen != null : "fx:id=\"appleScreen\" was not injected: check your FXML file 'JaceUI.fxml'."; + appleScreen.fitWidthProperty().bind(rootPane.widthProperty()); + appleScreen.fitHeightProperty().bind(rootPane.heightProperty()); } public void connectScreen(Video video) { diff --git a/src/main/resources/fxml/JaceUI.fxml b/src/main/resources/fxml/JaceUI.fxml index a08bf4d..52ca38b 100644 --- a/src/main/resources/fxml/JaceUI.fxml +++ b/src/main/resources/fxml/JaceUI.fxml @@ -8,7 +8,7 @@ - +