Experience with piecewise migration Swing -> JFX

John Smith John_Smith at symantec.com
Fri Jun 14 12:51:23 PDT 2013

+1 to all Scott wrote.

> There are JavaFX controls that cover *most* of the Swing controls.. but they are not 1:1.  There is no equivalent to FormattedTextField for example.  SplitPane behaves differently from the Swing equivalent.

There are some 3rd party efforts to bridge some of the gaps between the Swing and JavaFX core functionality.
For instance JIDE software just released a sleek FormattedTextField control (and other functionality): http://www.jidesoft.com/blog/2013/06/06/jidefx-beta-release/
And the jfxtras project http://jfxtras.org/ and http://fxexperience.com/controlsfx/ provide further such additions such as spinner controls, dialog boxes, etc.

There is a decent list of these 3rd party tools at:

There is a big difference between the scope of what a company like Jide provide in their standard swing toolkit (http://www.jidesoft.com/) and what they currently provide for JavaFX, so if you want something sophisticated like a pivot table that you don't want to write yourself, you need to use the Swing JFXPanel (or HTML via WebView) wrapping approach.
Note that JavaFX 8 introduces a Swing node so that you can embed Swing components in a JavaFX application - as that is pre-release software currently, nobody has used it yet for a commercial app.  However, for piecewise migration of a large Swing application, the existing JFXPanel should be more relevant.


-----Original Message-----
From: openjfx-dev-bounces at openjdk.java.net [mailto:openjfx-dev-bounces at openjdk.java.net] On Behalf Of Scott Palmer
Sent: Friday, June 14, 2013 8:46 AM
To: Robert Krüger
Cc: openjfx-dev at openjdk.java.net
Subject: Re: Experience with piecewise migration Swing -> JFX

Argh!  I'm not sure how that spontaneously sent...

I ran into issues with Drag and Drop.  You can drag an arbitrary Java object from Swing and drop it in JavaFX, but you can't drag the same thing from JavaFX, objects that start off in JavaFX must be Serializable to be placed on the DragBoard.

There are JavaFX controls that cover *most* of the Swing controls.. but they are not 1:1.  There is no equivalent to FormattedTextField for example.  SplitPane behaves differently from the Swing equivalent.
Tooltips work differently and can't be placed on MenuItems in JavaFX.

There are a lot of little things to do with different behaviour that come up that you need to work around, and there are still plenty of bugs.
Hopefully many of those issues will be resolved for JavaFX 8's release.  It all depends on your specific use cases though.

We started with a single JFXPanel in our app because we wanted to use it as core part ofthe UI in our otherwise Swing app.  Then we implemented a lot of dialogs that were basically JDialog + JFXPanel so that we could easily migrate the whole dialog to a pure JavaFX UI without a lot of fuss.  For our main UI that had a JFXPanel embedded among other Swing controls we just went from that to 100% JavaFX for the whole app rather than introducing many JFXPanels inside one JFrame.



On Fri, Jun 14, 2013 at 11:33 AM, Scott Palmer <swpalmer at gmail.com> wrote:

> Things that I ran into:
> On Fri, Jun 14, 2013 at 11:08 AM, Robert Krüger <krueger at lesspain.de>wrote:
>> Hi,
>> we're currently in the process of migrating our Swing application 
>> from Apple JDK 6 to OpenJDK 8 hoping to be able to ship it bundled 
>> with OpenJDK 8 in the coming months. In addition to that we're 
>> seriously considering a Migration of the UI to JFX and it appears 
>> very tempting to do this component-wise, i.e. using JFXPanel.
>> I have read and understood
>> http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm
>> but wanted to ask if someone has followed this route and could share 
>> their experience regarding caveats of this. How well does it work for 
>> a non-trivial application? What are the hidden problems one should be 
>> aware of (other than having 2 UI threads).
>> Thanks in advance,
>> Robert

More information about the openjfx-dev mailing list