On Fri, 7 Jul 2023 16:41:09 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
> Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Not > on FX application thread; currentThread = AWT-EventQueue-0 > at > javafx.graphics/com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:293) > at > javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:475) > at > javafx.graphics/javafx.scene.Parent$3.onProposedChange(Parent.java:475) > at > javafx.base/com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.jav You need to run with this change private static void initAndShowGUI() throws Exception { JFrame frame = new JFrame("Swing and JavaFX"); final JFXPanel fxPanel = new JFXPanel(); frame.add(fxPanel); frame.setSize(300, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if (!SET_FRAME_VISIBLE_LATE) { setFrameVisible(frame); } Platform.runLater(() -> { try { initFX(fxPanel, frame); } catch (Exception e) {} }); if (SET_FRAME_VISIBLE_LATE) { setFrameVisible(frame); } } private static void initFX(JFXPanel fxPanel, JFrame frame) throws Exception { // This method is invoked on the JavaFX thread Scene scene = createScene(); fxPanel.setScene(scene); } ------------- PR Comment: https://git.openjdk.org/jfx/pull/1171#issuecomment-1625674962