JavaFX 2 in NetBeans Platform Application with JFXPanel


February 12, 2012 by huionn

Yesterday I tried to integrate JavaFX 2.0 into my NetBeans Platform application. The process is not as smooth as I would expect, but it is successful at the end.


The steps are essentially:

  1. Download JavaFX SDK from
  2. Copy jfxrt.jar from <JAVAFX>/lib to <NETBEANS>/platform/lib and *.dll from <JAVAFX>/bin to <NETBEANS>/platform/bin.
    sidenote: it seems that for current release, it is unnecessary to use custom launcher to launch JavaFX (as shown in reference 1). According to reference 3,
    “Creating an instance of the JFXPanel class implicitly starts the JavaFX runtime.”
    (EDIT: I found that in order to bundle JavaFX into my NetBean Platform application, I need to copy those *.dll into folder <MODULE>\release\modules\lib)
  3. Restart NetBeans IDE. (I am not very sure whether this is necessary, but before restarting IDE, my application just consistently hanged when the JavaFX top component was opened.)
  4. Download JavaFX Samples from Adapt the SwingInterop sample to a new TopComponent. The porting is straightforward but remember to change the TopComponent’s layout to BorderLayout.
  5. That’s all.

The reason for me to explore JavaFX is its nice chart capabilities. Embedding JavaFX into Swing seems quite convenient as long as to invoke JavaFX UI code in JavaFX thread through

Platform.runLater(new Runnable() …)



One thought on “JavaFX 2 in NetBeans Platform Application with JFXPanel

  1. Yes, quite some time the custom launcher is not necessary 🙂

    best regards!

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: