From f9607a1a94bfc9b1b277fbb988ddd54050bdc908 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sun, 2 Oct 2016 22:18:51 +0200 Subject: [PATCH] [TASK] Fire up JFrames within awt thread. --- src/main/java/lu/jpt/csparqltest/Main.java | 12 +++++++++--- .../jpt/csparqltest/util/WindowLoggingRdfStream.java | 8 +++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/lu/jpt/csparqltest/Main.java b/src/main/java/lu/jpt/csparqltest/Main.java index 03f3373..b8cda92 100644 --- a/src/main/java/lu/jpt/csparqltest/Main.java +++ b/src/main/java/lu/jpt/csparqltest/Main.java @@ -25,9 +25,15 @@ public class Main { PropertyConfigurator.configure("/log4j.properties"); } // Initialize SimulationContext and wire it up with its control window - SimulationContext simulationContext = new SimulationContext(); - @SuppressWarnings("unused") - SimulationControlWindow simulationControlWindow = new SimulationControlWindow(simulationContext); + final SimulationContext simulationContext = new SimulationContext(); + // Fire up the control window + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + @SuppressWarnings("unused") + SimulationControlWindow simulationControlWindow = new SimulationControlWindow(simulationContext); + } + }); + // That's it, the program is now basically running on its own. } diff --git a/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java b/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java index 5bbbb45..12eb8ae 100644 --- a/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java +++ b/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java @@ -13,7 +13,13 @@ public class WindowLoggingRdfStream extends LoggableRdfStream { public WindowLoggingRdfStream(String iri) { super(iri); - this.observerWindow = new TextObserverWindow("[RdfStream] "+iri); + // Fire up the window + final WindowLoggingRdfStream me = this; + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + me.observerWindow = new TextObserverWindow("[RdfStream] "+iri); + } + }); } /**