Usable Browser

This commit is contained in:
UnlegitDqrk
2026-02-14 22:16:15 +01:00
parent c525fd3ae6
commit 016051e2ed
24 changed files with 2706 additions and 561 deletions

View File

@@ -0,0 +1,34 @@
package org.openautonomousconnection.webclient;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Initializes the JavaFX Toolkit exactly once for Swing embedding.
*/
public final class FxBootstrap {
private static final AtomicBoolean INITIALIZED = new AtomicBoolean(false);
private FxBootstrap() {
// Utility class
}
/**
* Ensures JavaFX Toolkit is initialized.
* Must be called before any Platform.runLater() usage.
*/
public static void ensureInitialized() {
if (!INITIALIZED.compareAndSet(false, true)) {
return;
}
// Creating a JFXPanel initializes the JavaFX toolkit in Swing apps.
new JFXPanel();
// Keep JavaFX runtime alive even if last window closes.
Platform.setImplicitExit(false);
}
}