From 55ed350e20173295a9a7bbf40aaf55e59d065dd9 Mon Sep 17 00:00:00 2001 From: Ivan Pribela Date: Fri, 8 Dec 2017 21:16:08 +0100 Subject: [PATCH] Lavirint, objedinjeno resenje, doterana inicijalizacija sistema za prikaz --- .../SuperKomplikovanoResenje/Prikaz.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Prikaz.java b/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Prikaz.java index 4553a24..92e2755 100644 --- a/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Prikaz.java +++ b/PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Prikaz.java @@ -3,6 +3,7 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CountDownLatch; import java.util.function.Function; import javafx.application.Application; @@ -11,7 +12,6 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.geometry.VPos; -import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; @@ -334,6 +334,8 @@ public class Prikaz extends Application { primaryStage.setScene(scene); primaryStage.show(); + pokrenut.countDown(); + } protected static void osveziPanelZaAnimaciju(Label labela, Button dugme, double vrednost) { @@ -475,12 +477,26 @@ public class Prikaz extends Application { // Pokretanje // //////////////// + protected static CountDownLatch pokrenut = new CountDownLatch(1); + protected static void pokreni() { - new JFXPanel(); Runnable launcher = () -> { launch(new String[] {}); }; new Thread(launcher).start(); + boolean bioPrekid = Thread.interrupted(); + boolean ok = false; + do { + try { + pokrenut.await(); + ok = true; + } catch (InterruptedException e) { + bioPrekid = true; + } + } while (!ok); + if (bioPrekid) { + Thread.currentThread().interrupt(); + } } protected static void odradiKasnije(Runnable zadatak) { -- 2.25.1