From 88de9476cc276dc1b97272ba5e88a0cd1ad9aa01 Mon Sep 17 00:00:00 2001 From: Luigi De Russis Date: Fri, 14 Nov 2014 10:20:17 +0100 Subject: [PATCH] ready for javafx 8 --- .../elite/teaching/cv/FXHelloCVController.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/FXHelloCV/src/it/polito/elite/teaching/cv/FXHelloCVController.java b/FXHelloCV/src/it/polito/elite/teaching/cv/FXHelloCVController.java index c28953a..5c3f983 100644 --- a/FXHelloCV/src/it/polito/elite/teaching/cv/FXHelloCVController.java +++ b/FXHelloCV/src/it/polito/elite/teaching/cv/FXHelloCVController.java @@ -55,7 +55,7 @@ protected void startCamera(ActionEvent event) if (this.mainApp != null) { // get the ImageView object for showing the video stream - final ImageView frameView = (ImageView) mainApp.getRootElement().lookup("#currentFrame"); + ImageView frameView = (ImageView) mainApp.getRootElement().lookup("#currentFrame"); // bind an image property with the container for frames final ObjectProperty imageProp = new SimpleObjectProperty<>(); frameView.imageProperty().bind(imageProp); @@ -77,7 +77,15 @@ public void run() { // update the image property => update the frame // shown in the UI - imageProp.set(grabFrame()); + final Image imageToShow = grabFrame(); + Platform.runLater(new Runnable() + { + @Override + public void run() + { + imageProp.setValue(imageToShow); + } + }); } }; this.timer = new Timer();