Skip to content

Commit

Permalink
Use Platform.runAndWait
Browse files Browse the repository at this point in the history
  • Loading branch information
prsadhuk committed Jan 22, 2024
1 parent 36aa335 commit 09be9a2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.util.concurrent.TimeUnit;

import com.sun.javafx.PlatformUtil;
import com.sun.javafx.application.PlatformImpl;

import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.embed.swing.JFXPanelShim;
Expand Down Expand Up @@ -82,7 +84,7 @@ public static void setupOnce() throws Exception {
launchLatch = new CountDownLatch(1);

// Start the Application
SwingUtilities.invokeAndWait(() -> myApp = new MyApp());
SwingUtilities.invokeLater(() -> myApp = new MyApp());

assertTrue("Timeout waiting for Application to launch",
launchLatch.await(5 * TIMEOUT, TimeUnit.MILLISECONDS));
Expand Down Expand Up @@ -149,7 +151,7 @@ public MyApp() {
}

private void createScene(final JFXPanel fxPanel) {
Platform.runLater(() -> {
PlatformImpl.runAndWait(() -> {
StackPane root = new StackPane();

Rectangle rect = new Rectangle(PANEL_WIDTH - 100, (double) PANEL_HEIGHT / 8);
Expand Down

0 comments on commit 09be9a2

Please sign in to comment.