Experience with piecewise migration Swing -> JFX

Robert Krüger krueger at lesspain.de
Sat Jun 15 01:52:14 PDT 2013

On Fri, Jun 14, 2013 at 5:46 PM, Scott Palmer <swpalmer at gmail.com> wrote:
> 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.

but I guess the standard flavors (dragging files between the two
worlds) do not cause problems. Right now we mostly have D&D for files.

> 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.

yes, regarding UI complexity we should be a not-so-difficult case as
most of the dialogs are rather straight-forward with standard controls
like JList, JCombobox, JTable, JTextfield etc..

> 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.

That is more or less the strategy we are thinking about:
- Migrate simple Dialogs to JFX-only
- Migrate application mainframe by replacing individual panels by JFX
impls until we can move to a JFX-only main frame.

My main concern was, if the mixing of the two technologies within one
JFrame/JDialog for the first phase of the migration was a no-go.

Thanks a lot for sharing your experience!

More information about the openjfx-dev mailing list