Mixing JavaFX with Swing in different windows

Artem Ananiev artem.ananiev at oracle.com
Tue Apr 24 08:21:34 PDT 2012

On 4/24/2012 6:04 PM, Josh Marinacci wrote:
> Has anyone had luck building an app with one window that is Swing and
> the other is JavaFX?  I want to slowly moving my large app
> (LeonardoSketch.org)  over to JavaFX.

It should just work, otherwise it's a bug. Create a JFXPanel object (it 
will trigger JFX runtime initialization), then use Platform.runLater() 
to create FX toplevels.

> I have built a new window in JavaFX but I get some init errors on
> startup. Instead I can put the FX content inside of a JXPanel, but

Could you provide more information about these errors, please?

> many things break on the FX side like drag and drop. I would rather

DnD in JFXPanel is fixed in 2.2, at least on Windows platform.

> run the FX content in a real FX stage.  I am fine having one window
> be run on the FX thread and one on the Swing thread with me being
> responsible for synchronization via invokeLater calls.  I'm wondering
> if there is any magic init-mojo required.
> Thanks
> Josh



More information about the openjfx-dev mailing list