Swing inside JavaFX: Myth or …?


More than one year since my last post… what a shame!  Despite this, I spent a lot of time working/playing with JavaFX.

My main focus was to deeply test JavaFX integration into existing Swing applications, which is currently pretty well handled by the JFXPanel. The main content that I tried to integrate into legacy Swing apps was the famous WebView node and I must admit this was really a pleasure to bring its functionalities into Swing apps. Of course, there are still some performance issues but this is really acceptable if you are not dealing with millions of data managed by a SVG rendering in html5 pages…

Now, what about the opposite? Swing legacy components inside brand new JavaFX applications? The SwingNode ? This is not available yet, even if it appears to be a priority in the “integration” map of JavaFX (extracted from JavaOne slides…). So, we have to be patient…

Since I really would like to see this integration ASAP, I bet that I could build my own SwingNode in less than a day… and I did :-).

Here is the result. This is a JavaFX application, with a SplitPane divided in two parts : a TreeView on the left hand side and a JTree on the right side, which is wrapped into my SwingNode component.

Quite impressive, no :-) ?! Mouse, drag and drop, keyboard…all works very well into this mixed application

If you’re still interested in knowing how it works, please add comments and I’ll add another post to demonstrate it and share the code with you.

See ya!

About these ads
  1. #1 by Gerrit Grunwald on 05/12/2012 - 19:20

    Looks good so far, is the code available somewhere, would like to play with it a bit?
    Cheers,
    Gerrit

  2. #2 by Amar on 10/12/2012 - 05:10

    Please share a post with the implementation details.

    Thanks,
    Amar

  3. #3 by MiPa on 10/12/2012 - 09:27

    If the stability and performance is ok I’d be very much interested to see how you did it.

  4. #4 by Crazy Doc on 10/12/2012 - 14:11

    Would be nice to see the some explanation, on how to do it, online. :)

  5. #5 by ed4becky on 10/12/2012 - 22:31

    I did a Swing in a JavaFX app before I knew it wasn’t really supported yet. All was well into I tried to run it on a Mac. Have you tried this code on a Mac yet?

  6. #6 by rasha on 11/12/2012 - 09:37

    Looking forward to a post about implementation details.

  7. #7 by Werner Lehmann on 12/12/2012 - 02:16

    Interesting. JavaFX AnimationTimer painting JComponent into a Canvas or something like that? Basically, JFXPanel does the opposite…

  8. #8 by Adrien on 13/12/2012 - 12:21

    I’m very interested in knowing how it works, do you plan to share the code ?

  9. #9 by arnaud nouard on 21/12/2012 - 22:40

    Code shared on 12/21/12 ! Just in time :-)

    • #10 by Per on 02/04/2013 - 10:30

      Hi,
      I am looking for this solution. Could you share the code?

      • #11 by Per on 02/04/2013 - 10:31

        Skip this. Found the code,

      • #12 by arnaud nouard on 02/04/2013 - 11:49

        For your information, an official SwingNode implementation should come with JavaFX8 (JDK 8). Check it out…

  10. #13 by Alex on 04/09/2013 - 18:00

    I’m very interested in knowing how it works, do you plan to share the code ?

    • #14 by arnaud nouard on 04/09/2013 - 18:23

      Hi,
      The code is already available, you’ll find links in the blog post.
      Cheers.

  1. Java desktop links of the week, December 10 | Jonathan Giles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: