5

Technically it has been "possible" to create a javafx/groovyfx based griffon application for quite a while.

How does swing compare to javafx nowadays ?

Can the latter be generally recommended for a fresh application without legacy baggage ?

Any gotchas to watch out for ?

How is the relationship griffon + javafx/groovyfx doing in general ?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Andreas Steffan
  • 6,039
  • 2
  • 23
  • 25

3 Answers3

8

JavaFX is the successor to Swing, and has many advantages over Swing, including:

  • A scene graph in which all nodes (e.g. UI components, shapes, images, containers) reside. This provides the ability to manipulate the properties of any node in UI with the result of affecting its contained nodes. For example, a Group containing some images may be rotated as a unit by applying a rotate transformation on the Group. Compare this to Swing, in which the UI is comprised of two separate worlds: UI Components and Java2D.

  • The WebView node is a WebKit port that that lets you embed a web browser in the scene graph.

  • CSS may be used for skinning the UI

  • FXML may be used to define the UI separately from the application logic. SceneBuilder, whose output is FXML, is a tool for drawing a UI.

There are currently some features that Swing developers mention that they miss, but you can take a look at the OpenJFX project http://openjdk.java.net/projects/openjfx/ and participate in this very active community to influence and contribute to future versions of JavaFX.

You may be interested in a technology position paper written by Björn Müller of CaptainCasa.com entitled "Why we use JavaFX" that discusses their architecture, including their decision to move from Swing to JavaFX http://captaincasa.blogspot.com/2013/01/why-we-use-javafx-paper.html

I hope this helps, and welcome you to check out the JavaFX Community site at javafxcommunity dot com to see the latest blog posts from JavaFX developers.

Regards, James Weaver Oracle Java Technology Ambassador

James Weaver
  • 113
  • 5
  • Thank you for pointing out the advantages of JavaFX. I was aware of them. I am asking how JavaFX compares to Swing in Griffon context. – Andreas Steffan Jan 29 '13 at 07:53
  • 4
    As you can see in the following link http://artifacts.griffon-framework.org/tags/plugin/javafx Griffon has a good number of JavaFX specific plugins. All other plugins such as remoting and persistence should work perfectly well with JavaFx too. Griffon also comes with 2 sample JavaFX applications: GroovyFXPad and FxBrowser. GroovyFX is used on views as a DSL, similarly as SwingBuilder is used for Swing, however you're free to use FXML or plain Java/JavaFX. – Andres Almiray Jan 29 '13 at 10:43
  • Assuming you would feel equally (un)comfortable with Swing and JavaFX. Would you go for JavaFX for a fresh griffon app, aalmiray ? – Andreas Steffan Jan 30 '13 at 11:56
  • As long as you stay away from fancy features such as tables, trees and treetables (Swing has more options right now) I'd say JavaFX is good to get started today. – Andres Almiray Mar 21 '13 at 08:18
0

I can recommend use javafx instead of swing. It's easy to learn and the apps look much better. I've made several applications using javafx with griffon at my work and I haven't been problems.

  • I didn't know that Griffon allows to easily switch between Swing and JavaFx. Can you point out how this is be done? Do you use plain JavaFX or GroovyFX? I would like to get some more informations. – ChrLipp Jan 27 '13 at 08:34
  • Here's one example of Griffon + JavaFX + FXML http://www.jroller.com/aalmiray/entry/griffon_i18n_fxml_content_on – Andres Almiray Jan 27 '13 at 12:18
0

Why, Where, and How JavaFX Makes Sense http://www.oracle.com/technetwork/articles/java/casa-1919152.html

dan
  • 1