Experience with piecewise migration Swing -> JFX

Werner Lehmann lehmann at media-interactive.de
Mon Jun 17 05:35:20 PDT 2013

In addition to what has been said before, you could check Jira for 
keywords jfxpanel and/or swing. Just today we had another Mac-only 
problem. Apparently AWT is not as thread-safe on Mac as it is on 
Windows, resulting in deadlocks in native AWT code (which currently is a 
guess, not confirmed, RT-31124).

Another relatively minor issue: if you have to use multiple JFXPanels on 
one Swing window the code can get quite complicated because of the 
frequent context switches between the GUI threads. Currently I am adding 
a note to the javadoc of UI methods to state which thread it is supposed 
to be called in.

Even with one JFXPanel and other Swing UI on the same window, you'll get 
a problem with tab focus movement: the jfxpanel would happily receive 
focus but then users cannot "tab out" of the jfxpanel.

Also seen today: after closing the last JFXPanel while the Swing 
application continues, FX would "exit the platform" (not the VM) and you 
cannot use another JFXPanel. There is probably some workaround available.

And just in case it has not been said before: you cannot have a Stage on 
top of a JFrame (modal or not). This forces you to wrap a JFXPanel into 
a JDialog.

I have also seen a performance problem. Try an indeterminate progressbar 
in a JFXPanel. The progressbar width directly correlates with CPU usage. 
With ~400px width I get about 20% CPU usage (almost one core). This is 
probably caused by constant pixel shifting to AWT.


On 14.06.2013 17:08, Robert Krüger wrote:
> What are the hidden problems one should be
> aware of (other than having 2 UI threads).

More information about the openjfx-dev mailing list