Using FXGraphics2D to display JFrame
Using FXGraphics2D to display JFrame
I'm new to both JFreeChart and JavaFX (though have used Java and Swing for a few years). I am trying to create an application that is built upon JavaFX and uses JFreeChart to display a bubbleChart. Is it possible to use FXGraphics2D to act as a bridge between JavaFX and JFrame containing the JSplitPane? If so, how would one accomplish this? Thank you for the help.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Using FXGraphics2D to display JFrame
You can look through the JFreeChart demo that is included with the FXGraphics2D download. Here is a link to the source file:
https://github.com/jfree/fxgraphics2d/b ... Demo1.java
You'll see at line 70 that there is a very basic ChartCanvas class that extends Canvas and is therefore a Node. You can place that anywhere in your JavaFX UI. The role of FXGraphics2D is *within* that chart canvas, to translate the JFreeChart drawing calls (which use the Graphics2D API) to the equivalent JavaFX Canvas rendering.
When I have time I plan to create a more full-featured ChartCanvas that supports some of the features that are found in the existing ChartPanel class that you can use in a Swing UI. This has been done for the Orson Charts viewer, but I didn't get to the JFreeChart one yet.
https://github.com/jfree/fxgraphics2d/b ... Demo1.java
You'll see at line 70 that there is a very basic ChartCanvas class that extends Canvas and is therefore a Node. You can place that anywhere in your JavaFX UI. The role of FXGraphics2D is *within* that chart canvas, to translate the JFreeChart drawing calls (which use the Graphics2D API) to the equivalent JavaFX Canvas rendering.
When I have time I plan to create a more full-featured ChartCanvas that supports some of the features that are found in the existing ChartPanel class that you can use in a Swing UI. This has been done for the Orson Charts viewer, but I didn't get to the JFreeChart one yet.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
-
- Posts: 2
- Joined: Mon Dec 29, 2014 5:26 am
- antibot: No, of course not.
- Location: Europe
- Contact:
Re: Using FXGraphics2D to display JFrame
Hi david.gilbert, I am new to this forum..Actually i was not aware of FXgraphics2D....Where the method of FXGraphics to used???That i can't under..I am waiting for the reply..Keep in touch with us..Thanks for your information