GroovyFX: or how to program JavaFX easily

  • 2,342 views
Uploaded on

An introduction to GroovyFX as the scripting language for JavaFX. JavaFX 1 had JavaFX Script, JavaFX 2 is just a Java API. GroovyFX steps up to the plate to be the scripting language for that API.

An introduction to GroovyFX as the scripting language for JavaFX. JavaFX 1 had JavaFX Script, JavaFX 2 is just a Java API. GroovyFX steps up to the plate to be the scripting language for that API.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,342
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
17
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. GroovyFX or How to Program JavaFX Easily Prof Russel Winder http://www.russel.org.uk email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: @russel_winderCopyright © 2013 Russel Winder 1
  • 2. Interstitial Advertisement ?Copyright © 2013 Russel Winder 2
  • 3. Java AWT AppletsCopyright © 2013 Russel Winder 3
  • 4. Copyright © 2013 Russel Winder 4
  • 5. Interregnum Java server-side onlyCopyright © 2013 Russel Winder 5
  • 6. Flex SilverlightCopyright © 2013 Russel Winder 6
  • 7. Copyright © 2013 Russel Winder 7
  • 8. JavaFXCopyright © 2013 Russel Winder 8
  • 9. JavaFX Script import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Font; import javafx.scene.text.Text; Stage { title: "Hello World" width: 250 height: 80 scene: Scene { content: Text { font: Font { size: 24 } x: 10, y: 30 content: "Hello World." } } } http://en.wikipedia.org/wiki/JavaFX_ScriptCopyright © 2013 Russel Winder 9
  • 10. Historical Context ● JavaFX ● Compete against: ● RIA framework ● Flex – JavaME ● Silverlight – JavaSE ● JavaFX ScriptCopyright © 2013 Russel Winder 10
  • 11. JavaFX didnt really catch on…Copyright © 2013 Russel Winder 11
  • 12. …despite JavaFX Script.Copyright © 2013 Russel Winder 12
  • 13. Copyright © 2013 Russel Winder 13
  • 14. Graphics Frameworks ● GTK, GObject: ● Glade ● Qt: ● Qt Designer ● Qt Quick/QML ● wxWidgets: ● wxGladeCopyright © 2013 Russel Winder 14
  • 15. The New JavaFX ● JavaFX 2: ● Java API for Java SE. ● Eventually a replacement for Swing. ● SceneBuilder ● FXML JavaFX == JavaFX 2Copyright © 2013 Russel Winder 15
  • 16. import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.stage.Stage; Import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; public class HelloWorld extends Application { @Override public void start(final Stage stage) { stage.setTitle("Hello World"); final Group rootNode = new Group(); final Text textNode = new Text(10, 30, "Hello World."); textNode.setFont(Font.font("Ocean Sans MT", 24)); rootNode.getChildren().add(textNode); final Scene sceneNode = new Scene(rootNode, 250, 80); sceneNode.setFill(Color.web(“#d0c4b0”)); stage.setScene(sceneNode); stage.show(); } public static void main(final String[] args) { launch(args); } }Copyright © 2013 Russel Winder 16
  • 17. No JavaFX ScriptCopyright © 2013 Russel Winder 17
  • 18. GroovyCopyright © 2013 Russel Winder 18
  • 19. Jim Clark Dean Iverson Dierk König Andres Almiray Russel WinderCopyright © 2013 Russel Winder 19
  • 20. GroovyFX import static groovyfx.javafx.GroovyFX.start import javafx.scene.paint.Color start { stage title: Hello World, visible: true, { scene width: 250, height: 80, fill: Color.web(#d0c4b0), { text x: 10, y: 30, text: Hello World., font: 24pt "Ocean Sans MT" } } }Copyright © 2013 Russel Winder 20
  • 21. Real Code http://nighthacking.comCopyright © 2013 Russel Winder 21
  • 22. Having Good Architectures ● Separate concerns. ● Code for structure and ● MVC (model, view logic. controller), MVP (model ● CSS (cascading style view presenter). sheets) for presentation. ● Mediator. ● Façade.Copyright © 2013 Russel Winder 22
  • 23. More code…Copyright © 2013 Russel Winder 23
  • 24. http://griffon.codehaus.org/Copyright © 2013 Russel Winder 24
  • 25. Interstitial Advertisement ?Copyright © 2013 Russel Winder 25
  • 26. GroovyFX or How to Program JavaFX Easily Prof Russel Winder http://www.russel.org.uk email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: @russel_winderCopyright © 2013 Russel Winder 26