gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
Lavirint, objedinjeno resenje, doterana inicijalizacija sistema za prikaz
authorIvan Pribela <ivanpribela@gmail.com>
Fri, 8 Dec 2017 20:16:08 +0000 (21:16 +0100)
committerIvan Pribela <ivanpribela@gmail.com>
Fri, 8 Dec 2017 20:16:08 +0000 (21:16 +0100)
PretrazivanjeSaVracanjem/Lavirint/SuperKomplikovanoResenje/Prikaz.java

index 4553a243bc0907d7ad52f9bb6cd457db975b5256..92e27555dc00242cef65b2a2c3e81683e8690a9b 100644 (file)
@@ -3,6 +3,7 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
+import java.util.concurrent.CountDownLatch;\r
 import java.util.function.Function;\r
 \r
 import javafx.application.Application;\r
@@ -11,7 +12,6 @@ import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;\r
 import javafx.geometry.Insets;\r
 import javafx.geometry.VPos;\r
-import javafx.embed.swing.JFXPanel;\r
 import javafx.scene.Scene;\r
 import javafx.scene.canvas.Canvas;\r
 import javafx.scene.canvas.GraphicsContext;\r
@@ -334,6 +334,8 @@ public class Prikaz extends Application {
         primaryStage.setScene(scene);\r
         primaryStage.show();\r
 \r
+        pokrenut.countDown();\r
+\r
     }\r
 \r
     protected static void osveziPanelZaAnimaciju(Label labela, Button dugme, double vrednost) {\r
@@ -475,12 +477,26 @@ public class Prikaz extends Application {
     // Pokretanje //\r
     ////////////////\r
 \r
+    protected static CountDownLatch pokrenut = new CountDownLatch(1);\r
+\r
     protected static void pokreni() {\r
-        new JFXPanel();\r
         Runnable launcher = () -> {\r
             launch(new String[] {});\r
         };\r
         new Thread(launcher).start();\r
+        boolean bioPrekid = Thread.interrupted();\r
+        boolean ok = false;\r
+        do {\r
+            try {\r
+                pokrenut.await();\r
+                ok = true;\r
+            } catch (InterruptedException e) {\r
+               bioPrekid = true;\r
+            }\r
+        } while (!ok);\r
+        if (bioPrekid) {\r
+            Thread.currentThread().interrupt();\r
+        }\r
     }\r
 \r
     protected static void odradiKasnije(Runnable zadatak) {\r
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner