Last night Mario and me put together a demo of JFreeChart running inside JavaFX, as a Swing panel, using the Swing-JavaFX integration that we implemented for ThingsFX. I packaged this demo as a webstart applet/application for you to try out live. This should work at least on Windows. Unfortunately not on Linux since JavaFX has not yet been released for Linux (Go, Oracle, Go!) and I haven’t tried on MacOS. If the demo doesn’t work for you, you can still watch the screencast that Mario did below. Notice that this is not JFreeChart rendered to an image and added as ImageView, it’s a live Swing panel added inside JavaFX (I am sure there could be more impressive demos showing animations in the charts or such… material for another post I guess
). The source code for the demo can be found here.
Can’t start the webstart. It sais I need java 1.7, but the JavaFX Download site sais, java 6u29 is the newest one.
For those who wants to be able to natively embed swing components inside JavaFX, please vote for corresponding JIRA item at the http://javafx-jira.kenai.com/browse/RT-12100
Hi,
I’m having an issue running this example. I’m getting the following exception and I’m having problems tracking the source of the problem.
Exception in thread “main” java.lang.Error: Unresolved compilation problem:
at com.thingsfx.widget.swing.FXSwingKeyboardFocusManagerPeer.getInstance(FXSwingKeyboardFocusManagerPeer.java:40)
at com.thingsfx.widget.swing.SwingFX.init(SwingFX.java:71)
at jfreechartdemo.JFreeFXDemo.main(JFreeFXDemo.java:34)
I’m using: Java: 1.6.0_25
I have javafx 2.0 in my path and the following dependencies: thingsfx-0.1.0-SNAPSHOT.jar, jfreechart-1.0.14.jar and jcommon-1.0.17.jar
Any idea what might be the cause of this exception?
Thanks in advance
Hi guys!
I’m using your code for showing a JFreeChart inside a Tab of a JavaFX application, but I’m not seeing the chart. I know part of it is working because if I do it with your JFreeChartFX class, it paints my chart perfectly.
The problems start when I try to integrate it with the rest of my application. What I need is to show a JFreeChart inside a Tab. The hierarchy is more or less the following:
Application -> Stage -> Scene -> BorderPane -> Center -> TabPane -> Tab -> Chart
I don’t know exactly where to call SwingFX.init(). I’ve tried at the main method, at the start method of the class that extends from Application, but so far, nothing.
Also: do I have to use SwingUtilities?
Thanks for the help.