This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,831 Users
  • 2,269,775 Discussions


Can I put a JAVA AWTChart inside a JAVAFX Pane?

vegaonline Member Posts: 1
edited Mar 16, 2016 5:21PM in JavaFX 2.0 and Later

I have an AWTChart chart which I need to place inside an AnchorPane. Please suggest me how can I do it.

Thanks and Regards



  • bouye-JavaNet
    bouye-JavaNet OfficeMember Posts: 394 Silver Badge
    edited Mar 16, 2016 5:21PM

    If it's something that simply extends AWT's Component and draw on a Graphics either through simple AWT drawing code or Java2D drawing code then convert it to Swing first by extending Swing's JComponent instead and by changing the drawing method name from paint() to paintComponent().

    Then verify that everything works the same in a Swing based UI,

    Once this is done embed it into a JavaFX UI by using JavaFX SwingNode instead.

    You can also use JFree's FXGraphics2D to directly use your AWT/Java2D rendering calls to draw on a JavaFX' Canvas node.

This discussion has been closed.