Experience with piecewise migration Swing -> JFX

Scott Palmer swpalmer at gmail.com
Fri Jun 14 08:46:18 PDT 2013

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