Marc H
Marc H

Reputation: 1258

Roles of JavaFx 2.0, Swing, and Java 2D in Java 7 Ecosystem

I am a bit confused as to the new standards. To the best of my understanding Swing -- the former standard interface library -- is based on it's predecesor, AWT, and the Java 2D graphics libraries.

Now that JavaFx 2.0 has replaced Swing my question is where does Java 2D fit in? Is it possible to use Java 2D methods to generate graphics on JavaFX interface elements?

Thank you

Upvotes: 0

Views: 1370

Answers (1)

jewelsea
jewelsea

Reputation: 159536

From the Oracle client tech lead's 10000 foot view of JavaFX.

At various times people have written articles or blog posts or forum posts asking the question, what is JavaFX? ... Is it a replacement for Swing? (The answer would be an emphatic Yes).

Mostly, use of Java2D is unnecessary with JavaFX as JavaFX has strong immediate and retained mode 2D apis.

If really needed, you can use Java2D methods to render to a buffer backing a JavaFX WritableImage or an awt image which you can later convert to a JavaFX image.

To an extent, you can still use Swing together with JavaFX if you want or need to. For example people have embedded a JavaFX webview in the Swing based NetBeans platform.

Upvotes: 1

Related Questions