SlideShare a Scribd company logo
1 of 82
JavaFX 2.0 and Alternative Languages Stephen Chin Chief Agile Methodologist, GXS steveonjava@gmail.com tweet: @steveonjava
About the Presenter Stephen Chin Java Champion Family Man Chief Agile Methodologist, GXS Author, Pro JavaFX Platform Motorcyclist
Disclaimer: This is code-heavy THE FOLLOWING IS INTENDED TO STIMULATE CREATIVE USE OF JVM LANGUAGES. AFTER WATCHING THIS PRESENTATION YOU MAY FEEL COMPELLED TO START LEARNING A NEW JVM LANGUAGE AND WANT TO APPLY IT AT YOUR WORKPLACE. THE PRESENTERS ARE NOT LIABLE FOR ANY INNOVATION, BREAKTHROUGHS, OR NP-COMPLETE SOLUTIONS THAT MAY RESULT.
Agenda JavaFX 2.0 Platform JavaFX in Java Explore Alternative Languages
JavaFX and the Java Platform  Java Language Java EE HotSpot Java VM Lightweight Java VM Java SE Java TV & Java ME Java Card Java FX APIs Copyright 2010 Oracle
JavaFX Design Goals Deliver the Best HTML5 & Native Application Experience from Java Programming model: the power of Java, the ease of JavaFX Native interoperability between Java, JavaScript & HTML5  High performance 2D and 3D Java graphics engine designed to exploit hardware advances in desktop & mobile Complete & integrated development lifecycle experience Copyright 2010 Oracle
Programming Languages JavaFX 2.0 APIs are now in Java Pure Java APIs for all of JavaFX Expose JavaFX Binding, Sequences as Java APIs Embrace all JVM languages JRuby, Clojure, Groovy, Scala Fantom, Mira, Jython, etc. JavaFX Script is no longer supported by Oracle Existing JavaFX Script based applications will continue to run Visage is the open-source successor to the JavaFX Script language Copyright 2010 Oracle
JavaFX 2.0 Product Timeline CYQ1 2011 CYQ3 2011 CYQ2 2011 JavaFX 2.0 EA (Early Access) JavaFX 2.0 Beta JavaFX 2.0 GA (General Availability) Copyright 2010 Oracle
JavaFX With Java
JavaFX in Java JavaFX API follows JavaBeans approach Similar in feel to other UI toolkits (Swing, etc) Uses builder pattern to minimize boilerplate
Binding Unquestionably the biggest JavaFX Script innovation Supported via a PropertyBinding class Lazy invocation for high performance Static construction syntax for simple cases e.g.: bindTo(<property>)
Observable Pseudo-Properties Supports watching for changes to properties Implemented via anonymous inner classes Will take advantage of closures in the future
Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { });
Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { }); The property we want to watch
Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { }); Only one listener used regardless of data type
Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() {   public void handle(Bean bean, PropertyReference pr) {   } }); Rectangle is a Bean
Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() {   public void handle(Bean bean, PropertyReference pr) {   } }); Refers to the Rectangle.hover ‘property’
Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() {   public void handle(Bean bean, PropertyReference pr) { rect.setFill(rect.isHover() ? Color.GREEN : Color.RED);   } });
Sequences in Java Replaced with an Observable List Public API is based on JavaFX sequences Internal code can use lighter collections API JavaFX 2.0 will also have an Observable Map
Example Application public class HelloStage extends Application {   @Override public void start() {     Stage stage = new Stage(); stage.setTitle("Hello Stage"); stage.setWidth(600);     stage.setHeight(450); Group root = new Group();     Scene scene = new Scene(root); scene.setFill(Color.LIGHTGREEN); stage.setScene(scene); stage.setVisible(true);   }   public static void main(String[] args) { Launcher.launch(HelloStage.class, args);   } }
JavaFX With JRuby
Why JRuby? ,[object Object]
Dynamic Typing
Closures
‘Closure conversion’ for interfaces,[object Object]
JRuby Example 1: Simple Stage require 'java' FX = Java::javafx.lang.FX Stage = Java::javafx.stage.Stage Scene = Java::javafx.scene.Scene Color = Java::javafx.scene.paint.Color class HelloStage   include java.lang.Runnable   def run     .....   end end FX.start(HelloStage.new); stage = Stage.new stage.title = 'Hello Stage (JRuby)' stage.width = 600 stage.height = 450 scene = Scene.new scene.fill = Color::LIGHTGREEN stage.scene = scene stage.visible = true;
JRuby Example 2 rect = Rectangle.new rect.x = 25 rect.y = 40 rect.width = 100 rect.height = 50 rect.fill = Color::RED scene.content.add(rect) timeline = Timeline.new timeline.repeat_count= Timeline::INDEFINITE timeline.auto_reverse = true kv = KeyValue.new(rect, Rectangle::X, 200); kf = KeyFrame.new(Duration.valueOf(500), kv); timeline.key_frames.addkf; timeline.play();
JRuby Closure Conversion rect.add_change_listener(Rectangle::HOVER) do |bean, pr, bln| rect.fill = rect.hover ? Color::GREEN : Color::RED; end 26
JRubySwiby require 'swiby' class HelloWorldModel attr_accessor :saying end model = HelloWorldModel.new model.saying = "Hello World" Frame {   title "Hello World“   width 200   content {     Label {       text bind(model,:saying)     }   }   visible true } 27
28 JavaFX With Clojure Artwork by Augusto Sellhorn http://sellmic.com/
A Little About      Clojure Started in 2007 by Rich Hickey Functional Programming Language Derived from LISP Optimized for High Concurrency … and looks nothing like Java! 29 (def hello (fn [] "Hello world")) (hello)
Clojure Syntax in One Slide Symbols numbers – 2.178 ratios – 355/113 strings – “clojure”, “rocks” characters –     symbols – a b c d keywords – :alpha :beta boolean – true, false null - nil Collections (commas optional) Lists (1, 2, 3, 4, 5) Vectors [1, 2, 3, 4, 5] Maps {:a 1, :b 2, :c 3, :d 4} Sets #{:a :b :c :d :e} 30 (plus macros that are syntactic sugar wrapping the above)
Clojure GUI Example (defnjavafxapp []   (let [stage (Stage. "JavaFX Stage")         scene (Scene.)]     (.setFill scene Color/LIGHTGREEN)     (.setWidth stage 600)     (.setHeight stage 450)     (.setScene stage scene)     (.setVisible stage true))) (javafxapp) 31
Clojure GUI Example (defnjavafxapp[]   (let [stage (Stage. "JavaFX Stage")         scene (Scene.)]     (.setFill scene Color/LIGHTGREEN)     (.setWidth stage 600)     (.setHeight stage 450)     (.setScene stage scene)     (.setVisible stage true))) (javafxapp) 32 Create a Function for the Application
Clojure GUI Example (defnjavafxapp [] (let [stage (Stage. "JavaFX Stage")         scene (Scene.)]     (.setFill scene Color/LIGHTGREEN)     (.setWidth stage 600)     (.setHeight stage 450)     (.setScene stage scene)     (.setVisible stage true))) (javafxapp) 33 Initialize the Stage and Scene Variables
Clojure GUI Example (defnjavafxapp []   (let [stage (Stage. "JavaFX Stage")         scene (Scene.)]     (.setFill scene Color/LIGHTGREEN)     (.setWidth stage 600)     (.setHeight stage 450)     (.setScene stage scene)     (.setVisible stage true))) (javafxapp) 34 Call Setter Methods on Scene and Stage
Clojure GUI Example (defnjavafxapp []   (let [stage (Stage. "JavaFX Stage")         scene (Scene.)]     (.setFillscene Color/LIGHTGREEN)     (.setWidthstage 600)     (.setHeightstage 450)     (.setScenestage scene)     (.setVisiblestage true))) (javafxapp) 35 Java Constant Syntax Java Method Syntax
Simpler Code Using doto (defnjavafxapp []   (let [stage (Stage. "JavaFX Stage")         scene (Scene.)]     (doto scene       (.setFillColor/LIGHTGREEN))     (doto stage       (.setWidth600)       (.setHeight450)       (.setScene scene)       (.setVisibletrue)))) (javafxapp) 36
Simpler Code Using doto (defnjavafxapp []   (let [stage (Stage. "JavaFX Stage")         scene (Scene.)]     (doto scene       (.setFillColor/LIGHTGREEN))     (doto stage       (.setWidth 600)       (.setHeight 450)       (.setScene scene)       (.setVisible true)))) (javafxapp) 37 doto form: (doto symbol    (.method params))  equals: (.method symbol params)
Refined Clojure GUI Example (defnjavafxapp []   (doto (Stage. "JavaFX Stage")     (.setWidth600)     (.setHeight450)     (.setScene (doto (Scene.)       (.setFillColor/LIGHTGREEN)       (.setContent (list (doto (Rectangle.)         (.setX25)         (.setY40)         (.setWidth100)         (.setHeight50)         (.setFillColor/RED))))))     (.setVisibletrue))) (javafxapp) 38
Refined Clojure GUI Example (defnjavafxapp []   (doto(Stage. "JavaFX Stage")     (.setWidth 600)     (.setHeight 450)     (.setScene (doto(Scene.)       (.setFillColor/LIGHTGREEN)       (.setContent (list (doto (Rectangle.)         (.setX 25)         (.setY 40)         (.setWidth 100)         (.setHeight 50)         (.setFillColor/RED))))))     (.setVisible true))) (javafxapp) 39 Let replaced with inline declarations
Refined Clojure GUI Example (defnjavafxapp []   (doto (Stage. "JavaFX Stage")     (.setWidth 600)     (.setHeight 450)     (.setScene (doto (Scene.)       (.setFillColor/LIGHTGREEN)       (.setContent (list (doto (Rectangle.)         (.setX 25)         (.setY 40)         (.setWidth 100)         (.setHeight 50)         (.setFillColor/RED))))))     (.setVisible true))) (javafxapp) 40 Doto allows nested data structures
Refined Clojure GUI Example (defnjavafxapp []   (doto (Stage. "JavaFX Stage")     (.setWidth 600)     (.setHeight 450)     (.setScene (doto (Scene.)       (.setFillColor/LIGHTGREEN)       (.setContent (list (doto (Rectangle.)         (.setX 25)         (.setY 40)         (.setWidth 100)         (.setHeight 50)         (.setFillColor/RED))))))     (.setVisible true))) (javafxapp) 41 Now a nested Rectangle fits!
Closures in Clojure 42 Inner classes can be created using proxy (.addChangeListenerrectRectangle/HOVER   (proxy [Listener] []     (handle [b, p]       (.setFillrect         (if (.isHoverrect) Color/GREEN Color/RED)))))
Closures in Clojure Inner classes can be created using proxy 43 Proxy form: (proxy [class] [args] fs+)  f => (name [params*] body) (.addChangeListenerrectRectangle/HOVER   (proxy[Listener][]     (handle [b, p]       (.setFillrect         (if (.isHoverrect) Color/GREEN Color/RED)))))
JavaFX With Groovy
Features of Groovy Tight integration with Java Very easy to port from Java to Groovy Declarative syntax Familiar to JavaFX Script developers Builders
Example 1: Simple FX Script to Groovy
Step 1: Lazy conversion to Groovy class HelloStage implements Runnable {  void run() {     Stage stage = new Stage(); stage.setTitle("Hello Stage (Groovy)“); stage.setWidth(600); stage.setHeight(450);     Scene scene = new Scene(); scene.setFill(Color.LIGHTSKYBLUE); stage.setScene(scene); stage.setVisible(true);   } static void main(args) { FX.start(new HelloStage());   } }
Step 2: Slightly More Groovy class HelloStage implements Runnable {     void run() {         new Stage(             title: "Hello Stage (Groovy)",             width: 600,             height: 450,             visible: true,             scene: new Scene(                 fill: Color.LIGHTSKYBLUE,             )         );     }     static void main(args) { FX.start(new HelloStage());     } }
Slight Aside: Groovy Builders Groovy builders make writing custom DSLs easy For the next slide, I am using a builder I defined Hopefully the community will improve upon this
Step 3: Using a Groovy Builder FxBuilder.build {     stage = stage(         title: "Hello World",           width: 600,           height: 450,         scene: scene(fill: Color.LIGHTSKYBLUE) {             ...         }     )     stage.visible = true; }
Step 4: With Content FxBuilder.build {     stage = stage(         title: "Hello Rectangle (Groovy FxBuilder 2)",           width: 600,           height: 450,         scene: scene(fill: Color.LIGHTSKYBLUE) {             rectangle(                 x: 25, y: 40,                 width: 100, height: 50,                 fill: Color.RED             )        }     )     stage.visible = true; }
Example 2: FX Script Animation in Groovy
Step 1: JavaFX Script def timeline = Timeline { repeatCount: Timeline.INDEFINITE autoReverse: true keyFrames: [ KeyFrame {       time: 750ms       values : [         rect1.x => 200.0 tweenInterpolator.LINEAR,         rect2.y => 200.0 tweenInterpolator.LINEAR,         circle1.radius => 200.0 tweenInterpolator.LINEAR       ]     }   ]; } timeline.play();
Step 1a: JavaFX Script Simplification def timeline = Timeline { repeatCount: Timeline.INDEFINITE autoReverse: true   keyFrames: at (750ms) {     rect1.x => 200.0 tween Interpolator.LINEAR;     rect2.y => 200.0 tween Interpolator.LINEAR;     circle1.radius => 200.0 tween Interpolator.LINEAR;   } } timeline.play();
Step 2: Java-ish Groovy Animations final Timeline timeline = new Timeline( repeatCount: Timeline.INDEFINITE, autoReverse: true ) final KeyValue kv1 = new KeyValue (rect1.x(), 200); final KeyValue kv2 = new KeyValue (rect2.y(), 200); final KeyValue kv3 = new KeyValue (circle1.radius(), 200); final KeyFramekf = new KeyFrame(Duration.valueOf(750), kv1, kv2, kv3); timeline.getKeyFrames().add(kf); timeline.play();
Step 3: JavaFX Animation Groovy DSL (courtesy of Jim Clarke – work in progress) timeline = timeline(repeatCount: Timeline.INDEFINITE, autoReverse: true) {   at 750.ms update values {    change rect1.y() to 200    change rect2.x() to 200    change circle.radius() to 200  } } timeline.play();
Groovy Closures  - With interface coercion def f = {    bean, pr-> rect.setFill(rect.isHover() ? Color.GREEN : Color.RED); } as Listener; rect.addChangedListener(Rectangle.HOVER, f);
58 JavaFX With Scala
What is Scala Started in 2001 by Martin Odersky Compiles to Java bytecodes Pure object-oriented language Also a functional programming language 59
Why Scala? Shares many language features with JavaFX Script that make GUI programming easier: Static type checking – Catch your errors at compile time Closures – Wrap behavior and pass it by reference Declarative – Express the UI by describing what it should look like Scala also supports DSLs! 60
Java vs. Scala DSL public class HelloStage implements Runnable {   public void run() {     Stage stage = new Stage(); stage.setTitle("Hello Stage"); stage.setWidth(600); stage.setHeight(450);     Scene scene = new Scene(); scene.setFill(Color.LIGHTGREEN);     Rectangle rect = new Rectangle(); rect.setX(25); rect.setY(40); rect.setWidth(100); rect.setHeight(50); rect.setFill(Color.RED); stage.add(rect); stage.setScene(scene); stage.setVisible(true);   }   public static void main(String[] args) { FX.start(new HelloStage());   } } object HelloJavaFX extends JavaFXApplication {   def stage = new Stage {     title = "Hello Stage"     width = 600     height = 450     scene = new Scene {       fill = Color.LIGHTGREEN       content = List(new Rectangle {         x = 25         y = 40         width = 100         height = 50         fill = Color.RED       })     }   } } 61 22 Lines 545 Characters 17 Lines 324 Characters
object HelloJavaFX extends JavaFXApplication {   def stage = new Stage {     title = "Hello Stage"     width = 600     height = 450     scene = new Scene {       fill = Color.LIGHTGREEN       content = List(new Rectangle {         x = 25         y = 40         width = 100         height = 50         fill = Color.RED       })     }   } } 62
63 object HelloJavaFX extends JavaFXApplication {   def stage = new Stage {     title = "Hello Stage"     width = 600     height = 450     scene = new Scene {       fill = Color.LIGHTGREEN       content = List(new Rectangle {         x = 25         y = 40         width = 100         height = 50         fill = Color.RED       })     }   } } object HelloJavaFX extends JavaFXApplication {   def stage = new Stage {     title = "Hello Stage"     width = 600     height = 450     scene = new Scene {       fill = Color.LIGHTGREEN       content = List(new Rectangle {         x = 25         y = 40         width = 100         height = 50         fill = Color.RED       })     }   } } Base class for JavaFX applications
64 object HelloJavaFX extends JavaFXApplication { def stage = new Stage {     title = "Hello Stage"     width = 600     height = 450     scene = new Scene {       fill = Color.LIGHTGREEN       content = List(new Rectangle {         x = 25         y = 40         width = 100         height = 50         fill = Color.RED       })     }   } } Declarative Stage definition
65 object HelloJavaFX extends JavaFXApplication {   def stage = new Stage { title = "Hello Stage"     width = 600     height = 450     scene = new Scene {       fill = Color.LIGHTGREEN       content = List(new Rectangle {         x = 25         y = 40         width = 100         height = 50         fill = Color.RED       })     }   } } Inline property definitions
66 object HelloJavaFX extends JavaFXApplication {   def stage = new Stage {     title = "Hello Stage"     width = 600     height = 450     scene = new Scene {       fill = Color.LIGHTGREEN       content = List(new Rectangle {         x = 25         y = 40         width = 100         height = 50         fill = Color.RED       })     }   } } List Construction Syntax
Animation in Scala def timeline = new Timeline { repeatCount = INDEFINITE autoReverse = true keyFrames = List(       new KeyFrame(time: 50) {         values = List(           new KeyValue(rect1.x() -> 300),           new KeyValue(rect2.y() -> 500),           new KeyValue(rect2.width() -> 150)         )       }     )   } 67
def timeline = new Timeline { repeatCount = INDEFINITE autoReverse = true keyFrames = List(       new KeyFrame(time: 50) {         values = List(           new KeyValue(rect1.x() -> 300),           new KeyValue(rect2.y() -> 500),           new KeyValue(rect2.width() -> 150)         )       }     )   } Animation in Scala 68 Duration set by Constructor Parameter
Animation in Scala 69 def timeline = new Timeline { repeatCount = INDEFINITE autoReverse = true keyFrames = List(       new KeyFrame(time: 50) {         values = List(           new KeyValue(rect1.x() -> 300),           new KeyValue(rect2.y() -> 500),           new KeyValue(rect2.width() -> 150)         )       }     )   } Operator overloading for animation syntax
Closures in Scala 70 Closures are also supported in Scala And they are 100% type-safe rect.addChangedListener(Node.HOVER, (b, p) => { rect.fill = if (rect.hover) Color.GREEN else Color.RED })
Closures in Scala Closures are also supported in Scala And they are 100% type-safe 71 rect.addChangedListener(Node.HOVER, (b, p) => { rect.fill = if (rect.hover) Color.GREEN else Color.RED }) Compact syntax (params) => {body}
Other JVM Languages to Try Jython Started by Jim Hugunin High Performance Python Mirah Invented by Charles Nutter Originally called Duby Local Type Inference, Static and Dynamic Typing Fantom Created by Brian and Andy Frank Originally called Fan Built-in Declarative Syntax Portable to Java and .NET Local Type Inference, Static and Dynamic Typing 72
Fantom Code Example Void main() {   Stage {     title= "Hello Stage"     width= 600     height= 450    Scene {       fill= Color.LIGHTGREEN       Rectangle {         x= 25         y= 40         width= 100         height= 50         fill= Color.RED       }     }   }.open } 73
timeline := Timeline {   repeatCount = Timeline.INDEFINITE   autoReverse = true KeyFrame {    time = 50ms KeyValue(rect1.x()-> 300),     KeyValue(rect2.y() -> 500),     KeyValue(rect2.width() -> 150) } } Animation in Fantom 74 Fantom has a built-in Duration type And also supports operator overloading
Announcing Project Visage 75 ,[object Object],Visage project goals: Compile to JavaFX Java APIs Evolve the Language (Annotations, Maps, etc.) Support Other Toolkits Come join the team! For more info: http://visage-lang.org/
How about JavaFX on…  Visage Stage {   title: "Hello Stage"   width: 600   height: 450  scene: Scene {     fill: Color.LIGHTGREEN     content: Rectangle {       x: 25       y: 40       width: 100       height: 50       fill: Color.RED     }   } } 76
How about JavaFX on…  Visage Stage {   title: "Hello Stage"   width: 600   height: 450 scene: Scene {     fill: Color.LIGHTGREEN content: Rectangle {       x: 25       y: 40       width: 100       height: 50       fill: Color.RED     }   } } 77
How about JavaFX on…  Visage Stage {   title: "Hello Stage"   width: 600   height: 450  Scene {     fill: Color.LIGHTGREEN     Rectangle {       x: 25       y: 40       width: 100       height: 50       fill: Color.RED     }   } } 78
Conclusion You can write JavaFX applications in pure Java JavaFX is also usable in alternate languages Over time improved support is possible Groovy Builders, Scala DSL, Visage Remember: This is a proof of concept only – you can not leave this session and do this today.
Challenge the Presenter…

More Related Content

What's hot

The Magnificent Seven
The Magnificent SevenThe Magnificent Seven
The Magnificent SevenMike Fogus
 
Design Patterns in Luster
Design Patterns in LusterDesign Patterns in Luster
Design Patterns in LusterJason Chung
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldBTI360
 
Using Redux-Saga for Handling Side Effects
Using Redux-Saga for Handling Side EffectsUsing Redux-Saga for Handling Side Effects
Using Redux-Saga for Handling Side EffectsGlobalLogic Ukraine
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
 
Python decorators (中文)
Python decorators (中文)Python decorators (中文)
Python decorators (中文)Yiwei Chen
 
JavaScript Web Development
JavaScript Web DevelopmentJavaScript Web Development
JavaScript Web Developmentvito jeng
 
Codestrong 2012 breakout session hacking titanium
Codestrong 2012 breakout session   hacking titaniumCodestrong 2012 breakout session   hacking titanium
Codestrong 2012 breakout session hacking titaniumAxway Appcelerator
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
The Challenge of Bringing FEZ to PlayStation Platforms
The Challenge of Bringing FEZ to PlayStation PlatformsThe Challenge of Bringing FEZ to PlayStation Platforms
The Challenge of Bringing FEZ to PlayStation PlatformsMiguel Angel Horna
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React AlicanteIgnacio Martín
 
bullismo e scuola primaria
bullismo e scuola primariabullismo e scuola primaria
bullismo e scuola primariaimartini
 
Kotlin Coroutines Reloaded
Kotlin Coroutines ReloadedKotlin Coroutines Reloaded
Kotlin Coroutines ReloadedRoman Elizarov
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTsKevlin Henney
 
The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202Mahmoud Samir Fayed
 

What's hot (20)

The Magnificent Seven
The Magnificent SevenThe Magnificent Seven
The Magnificent Seven
 
Design Patterns in Luster
Design Patterns in LusterDesign Patterns in Luster
Design Patterns in Luster
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 World
 
Using Redux-Saga for Handling Side Effects
Using Redux-Saga for Handling Side EffectsUsing Redux-Saga for Handling Side Effects
Using Redux-Saga for Handling Side Effects
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duo
 
Python decorators (中文)
Python decorators (中文)Python decorators (中文)
Python decorators (中文)
 
The Groovy Way
The Groovy WayThe Groovy Way
The Groovy Way
 
JavaScript Web Development
JavaScript Web DevelopmentJavaScript Web Development
JavaScript Web Development
 
ZIO Queue
ZIO QueueZIO Queue
ZIO Queue
 
Codestrong 2012 breakout session hacking titanium
Codestrong 2012 breakout session   hacking titaniumCodestrong 2012 breakout session   hacking titanium
Codestrong 2012 breakout session hacking titanium
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
The Challenge of Bringing FEZ to PlayStation Platforms
The Challenge of Bringing FEZ to PlayStation PlatformsThe Challenge of Bringing FEZ to PlayStation Platforms
The Challenge of Bringing FEZ to PlayStation Platforms
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
 
bullismo e scuola primaria
bullismo e scuola primariabullismo e scuola primaria
bullismo e scuola primaria
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
 
Kotlin Coroutines Reloaded
Kotlin Coroutines ReloadedKotlin Coroutines Reloaded
Kotlin Coroutines Reloaded
 
Your code is not a string
Your code is not a stringYour code is not a string
Your code is not a string
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
 
The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202
 

Viewers also liked

JavaFX 2.1 - следующее поколение клиентской Java
JavaFX 2.1 - следующее поколение клиентской JavaJavaFX 2.1 - следующее поколение клиентской Java
JavaFX 2.1 - следующее поколение клиентской JavaAlexander_K
 
01 - JavaFX. Введение в JavaFX
01 - JavaFX. Введение в JavaFX01 - JavaFX. Введение в JavaFX
01 - JavaFX. Введение в JavaFXRoman Brovko
 
JavaFX in Action (devoxx'16)
JavaFX in Action (devoxx'16)JavaFX in Action (devoxx'16)
JavaFX in Action (devoxx'16)Alexander Casall
 
Presentation - Course about JavaFX
Presentation - Course about JavaFXPresentation - Course about JavaFX
Presentation - Course about JavaFXTom Mix Petreca
 
8 True Stories about JavaFX
8 True Stories about JavaFX8 True Stories about JavaFX
8 True Stories about JavaFXYuichi Sakuraba
 
JavaFX for Java Developers
JavaFX for Java DevelopersJavaFX for Java Developers
JavaFX for Java DevelopersSten Anderson
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFXRichard Bair
 

Viewers also liked (14)

JavaFX 2.1 - следующее поколение клиентской Java
JavaFX 2.1 - следующее поколение клиентской JavaJavaFX 2.1 - следующее поколение клиентской Java
JavaFX 2.1 - следующее поколение клиентской Java
 
JavaFX technology
JavaFX technologyJavaFX technology
JavaFX technology
 
JavaFX 2.0 overview
JavaFX 2.0 overviewJavaFX 2.0 overview
JavaFX 2.0 overview
 
01 - JavaFX. Введение в JavaFX
01 - JavaFX. Введение в JavaFX01 - JavaFX. Введение в JavaFX
01 - JavaFX. Введение в JavaFX
 
JavaFX introduction
JavaFX introductionJavaFX introduction
JavaFX introduction
 
JavaFX Advanced
JavaFX AdvancedJavaFX Advanced
JavaFX Advanced
 
Introduction to JavaFX 2
Introduction to JavaFX 2Introduction to JavaFX 2
Introduction to JavaFX 2
 
JavaFX in Action (devoxx'16)
JavaFX in Action (devoxx'16)JavaFX in Action (devoxx'16)
JavaFX in Action (devoxx'16)
 
Presentation - Course about JavaFX
Presentation - Course about JavaFXPresentation - Course about JavaFX
Presentation - Course about JavaFX
 
JavaFX Overview
JavaFX OverviewJavaFX Overview
JavaFX Overview
 
8 True Stories about JavaFX
8 True Stories about JavaFX8 True Stories about JavaFX
8 True Stories about JavaFX
 
Mini-curso JavaFX Aula1
Mini-curso JavaFX Aula1Mini-curso JavaFX Aula1
Mini-curso JavaFX Aula1
 
JavaFX for Java Developers
JavaFX for Java DevelopersJavaFX for Java Developers
JavaFX for Java Developers
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
 

Similar to JavaFX 2.0 and Alternative Languages

JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...Stephen Chin
 
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...Stephen Chin
 
JavaFX Your Way - Devoxx Version
JavaFX Your Way - Devoxx VersionJavaFX Your Way - Devoxx Version
JavaFX Your Way - Devoxx VersionStephen Chin
 
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative LanguagesJavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative LanguagesStephen Chin
 
JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011Stephen Chin
 
JavaFX 2.0 With Alternative Languages [Portuguese]
JavaFX 2.0 With Alternative Languages [Portuguese]JavaFX 2.0 With Alternative Languages [Portuguese]
JavaFX 2.0 With Alternative Languages [Portuguese]Stephen Chin
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen ChinHacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chinjaxconf
 
Don't panic in Fortaleza - ScalaFX
Don't panic in Fortaleza - ScalaFXDon't panic in Fortaleza - ScalaFX
Don't panic in Fortaleza - ScalaFXAlain Béarez
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx WorkshopDierk König
 
XML-Free Programming
XML-Free ProgrammingXML-Free Programming
XML-Free ProgrammingStephen Chin
 
The Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideThe Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideStephen Chin
 
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)Stephen Chin
 
Intro to JavaFX & Widget FX
Intro to JavaFX & Widget FXIntro to JavaFX & Widget FX
Intro to JavaFX & Widget FXStephen Chin
 
Java Fx Overview Tech Tour
Java Fx Overview Tech TourJava Fx Overview Tech Tour
Java Fx Overview Tech TourCarol McDonald
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and VisageHacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and VisageStephen Chin
 
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...Naresha K
 
Vert.x - Reactive & Distributed [Devoxx version]
Vert.x - Reactive & Distributed [Devoxx version]Vert.x - Reactive & Distributed [Devoxx version]
Vert.x - Reactive & Distributed [Devoxx version]Orkhan Gasimov
 

Similar to JavaFX 2.0 and Alternative Languages (20)

JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
 
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
 
JavaFX Your Way - Devoxx Version
JavaFX Your Way - Devoxx VersionJavaFX Your Way - Devoxx Version
JavaFX Your Way - Devoxx Version
 
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative LanguagesJavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
 
JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011
 
JavaFX 2.0 With Alternative Languages [Portuguese]
JavaFX 2.0 With Alternative Languages [Portuguese]JavaFX 2.0 With Alternative Languages [Portuguese]
JavaFX 2.0 With Alternative Languages [Portuguese]
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen ChinHacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
 
Groovy's Builder
Groovy's BuilderGroovy's Builder
Groovy's Builder
 
Don't panic in Fortaleza - ScalaFX
Don't panic in Fortaleza - ScalaFXDon't panic in Fortaleza - ScalaFX
Don't panic in Fortaleza - ScalaFX
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx Workshop
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
JavaFX
JavaFXJavaFX
JavaFX
 
XML-Free Programming
XML-Free ProgrammingXML-Free Programming
XML-Free Programming
 
The Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideThe Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S Guide
 
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
 
Intro to JavaFX & Widget FX
Intro to JavaFX & Widget FXIntro to JavaFX & Widget FX
Intro to JavaFX & Widget FX
 
Java Fx Overview Tech Tour
Java Fx Overview Tech TourJava Fx Overview Tech Tour
Java Fx Overview Tech Tour
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and VisageHacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
 
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
 
Vert.x - Reactive & Distributed [Devoxx version]
Vert.x - Reactive & Distributed [Devoxx version]Vert.x - Reactive & Distributed [Devoxx version]
Vert.x - Reactive & Distributed [Devoxx version]
 

More from Stephen Chin

DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2Stephen Chin
 
10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java CommunityStephen Chin
 
Java Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive GuideJava Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive GuideStephen Chin
 
DevOps Tools for Java Developers
DevOps Tools for Java DevelopersDevOps Tools for Java Developers
DevOps Tools for Java DevelopersStephen Chin
 
Java Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJCJava Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJCStephen Chin
 
RetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming ConsoleRetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming ConsoleStephen Chin
 
JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)Stephen Chin
 
Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)Stephen Chin
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopStephen Chin
 
Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)Stephen Chin
 
Confessions of a Former Agile Methodologist
Confessions of a Former Agile MethodologistConfessions of a Former Agile Methodologist
Confessions of a Former Agile MethodologistStephen Chin
 
Internet of Things Magic Show
Internet of Things Magic ShowInternet of Things Magic Show
Internet of Things Magic ShowStephen Chin
 
Zombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the UndeadZombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the UndeadStephen Chin
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java WorkshopStephen Chin
 
Oracle IoT Kids Workshop
Oracle IoT Kids WorkshopOracle IoT Kids Workshop
Oracle IoT Kids WorkshopStephen Chin
 
OpenJFX on Android and Devices
OpenJFX on Android and DevicesOpenJFX on Android and Devices
OpenJFX on Android and DevicesStephen Chin
 
Java on Raspberry Pi Lab
Java on Raspberry Pi LabJava on Raspberry Pi Lab
Java on Raspberry Pi LabStephen Chin
 
Java 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and LegosJava 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and LegosStephen Chin
 
Devoxx4Kids NAO Workshop
Devoxx4Kids NAO WorkshopDevoxx4Kids NAO Workshop
Devoxx4Kids NAO WorkshopStephen Chin
 

More from Stephen Chin (20)

DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2
 
10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community
 
Java Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive GuideJava Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive Guide
 
DevOps Tools for Java Developers
DevOps Tools for Java DevelopersDevOps Tools for Java Developers
DevOps Tools for Java Developers
 
Java Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJCJava Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJC
 
RetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming ConsoleRetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming Console
 
JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)
 
Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego Workshop
 
Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)
 
Confessions of a Former Agile Methodologist
Confessions of a Former Agile MethodologistConfessions of a Former Agile Methodologist
Confessions of a Former Agile Methodologist
 
Internet of Things Magic Show
Internet of Things Magic ShowInternet of Things Magic Show
Internet of Things Magic Show
 
Zombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the UndeadZombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the Undead
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java Workshop
 
Oracle IoT Kids Workshop
Oracle IoT Kids WorkshopOracle IoT Kids Workshop
Oracle IoT Kids Workshop
 
OpenJFX on Android and Devices
OpenJFX on Android and DevicesOpenJFX on Android and Devices
OpenJFX on Android and Devices
 
Java on Raspberry Pi Lab
Java on Raspberry Pi LabJava on Raspberry Pi Lab
Java on Raspberry Pi Lab
 
Java 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and LegosJava 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and Legos
 
DukeScript
DukeScriptDukeScript
DukeScript
 
Devoxx4Kids NAO Workshop
Devoxx4Kids NAO WorkshopDevoxx4Kids NAO Workshop
Devoxx4Kids NAO Workshop
 

Recently uploaded

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Recently uploaded (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

JavaFX 2.0 and Alternative Languages

  • 1. JavaFX 2.0 and Alternative Languages Stephen Chin Chief Agile Methodologist, GXS steveonjava@gmail.com tweet: @steveonjava
  • 2. About the Presenter Stephen Chin Java Champion Family Man Chief Agile Methodologist, GXS Author, Pro JavaFX Platform Motorcyclist
  • 3. Disclaimer: This is code-heavy THE FOLLOWING IS INTENDED TO STIMULATE CREATIVE USE OF JVM LANGUAGES. AFTER WATCHING THIS PRESENTATION YOU MAY FEEL COMPELLED TO START LEARNING A NEW JVM LANGUAGE AND WANT TO APPLY IT AT YOUR WORKPLACE. THE PRESENTERS ARE NOT LIABLE FOR ANY INNOVATION, BREAKTHROUGHS, OR NP-COMPLETE SOLUTIONS THAT MAY RESULT.
  • 4. Agenda JavaFX 2.0 Platform JavaFX in Java Explore Alternative Languages
  • 5. JavaFX and the Java Platform Java Language Java EE HotSpot Java VM Lightweight Java VM Java SE Java TV & Java ME Java Card Java FX APIs Copyright 2010 Oracle
  • 6. JavaFX Design Goals Deliver the Best HTML5 & Native Application Experience from Java Programming model: the power of Java, the ease of JavaFX Native interoperability between Java, JavaScript & HTML5 High performance 2D and 3D Java graphics engine designed to exploit hardware advances in desktop & mobile Complete & integrated development lifecycle experience Copyright 2010 Oracle
  • 7. Programming Languages JavaFX 2.0 APIs are now in Java Pure Java APIs for all of JavaFX Expose JavaFX Binding, Sequences as Java APIs Embrace all JVM languages JRuby, Clojure, Groovy, Scala Fantom, Mira, Jython, etc. JavaFX Script is no longer supported by Oracle Existing JavaFX Script based applications will continue to run Visage is the open-source successor to the JavaFX Script language Copyright 2010 Oracle
  • 8. JavaFX 2.0 Product Timeline CYQ1 2011 CYQ3 2011 CYQ2 2011 JavaFX 2.0 EA (Early Access) JavaFX 2.0 Beta JavaFX 2.0 GA (General Availability) Copyright 2010 Oracle
  • 10. JavaFX in Java JavaFX API follows JavaBeans approach Similar in feel to other UI toolkits (Swing, etc) Uses builder pattern to minimize boilerplate
  • 11. Binding Unquestionably the biggest JavaFX Script innovation Supported via a PropertyBinding class Lazy invocation for high performance Static construction syntax for simple cases e.g.: bindTo(<property>)
  • 12. Observable Pseudo-Properties Supports watching for changes to properties Implemented via anonymous inner classes Will take advantage of closures in the future
  • 13. Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { });
  • 14. Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { }); The property we want to watch
  • 15. Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { }); Only one listener used regardless of data type
  • 16. Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { public void handle(Bean bean, PropertyReference pr) { } }); Rectangle is a Bean
  • 17. Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { public void handle(Bean bean, PropertyReference pr) { } }); Refers to the Rectangle.hover ‘property’
  • 18. Observable Pseudo-Properties Rectangle rect = new Rectangle(); rect.setX(40); rect.setY(40); rect.setWidth(100); rect.setHeight(200); rect.addChangeListener(Rectangle.HOVER, new ChangeListener() { public void handle(Bean bean, PropertyReference pr) { rect.setFill(rect.isHover() ? Color.GREEN : Color.RED); } });
  • 19. Sequences in Java Replaced with an Observable List Public API is based on JavaFX sequences Internal code can use lighter collections API JavaFX 2.0 will also have an Observable Map
  • 20. Example Application public class HelloStage extends Application { @Override public void start() { Stage stage = new Stage(); stage.setTitle("Hello Stage"); stage.setWidth(600); stage.setHeight(450); Group root = new Group(); Scene scene = new Scene(root); scene.setFill(Color.LIGHTGREEN); stage.setScene(scene); stage.setVisible(true); } public static void main(String[] args) { Launcher.launch(HelloStage.class, args); } }
  • 22.
  • 25.
  • 26. JRuby Example 1: Simple Stage require 'java' FX = Java::javafx.lang.FX Stage = Java::javafx.stage.Stage Scene = Java::javafx.scene.Scene Color = Java::javafx.scene.paint.Color class HelloStage include java.lang.Runnable def run ..... end end FX.start(HelloStage.new); stage = Stage.new stage.title = 'Hello Stage (JRuby)' stage.width = 600 stage.height = 450 scene = Scene.new scene.fill = Color::LIGHTGREEN stage.scene = scene stage.visible = true;
  • 27. JRuby Example 2 rect = Rectangle.new rect.x = 25 rect.y = 40 rect.width = 100 rect.height = 50 rect.fill = Color::RED scene.content.add(rect) timeline = Timeline.new timeline.repeat_count= Timeline::INDEFINITE timeline.auto_reverse = true kv = KeyValue.new(rect, Rectangle::X, 200); kf = KeyFrame.new(Duration.valueOf(500), kv); timeline.key_frames.addkf; timeline.play();
  • 28. JRuby Closure Conversion rect.add_change_listener(Rectangle::HOVER) do |bean, pr, bln| rect.fill = rect.hover ? Color::GREEN : Color::RED; end 26
  • 29. JRubySwiby require 'swiby' class HelloWorldModel attr_accessor :saying end model = HelloWorldModel.new model.saying = "Hello World" Frame { title "Hello World“ width 200 content { Label { text bind(model,:saying) } } visible true } 27
  • 30. 28 JavaFX With Clojure Artwork by Augusto Sellhorn http://sellmic.com/
  • 31. A Little About Clojure Started in 2007 by Rich Hickey Functional Programming Language Derived from LISP Optimized for High Concurrency … and looks nothing like Java! 29 (def hello (fn [] "Hello world")) (hello)
  • 32. Clojure Syntax in One Slide Symbols numbers – 2.178 ratios – 355/113 strings – “clojure”, “rocks” characters – symbols – a b c d keywords – :alpha :beta boolean – true, false null - nil Collections (commas optional) Lists (1, 2, 3, 4, 5) Vectors [1, 2, 3, 4, 5] Maps {:a 1, :b 2, :c 3, :d 4} Sets #{:a :b :c :d :e} 30 (plus macros that are syntactic sugar wrapping the above)
  • 33. Clojure GUI Example (defnjavafxapp [] (let [stage (Stage. "JavaFX Stage") scene (Scene.)] (.setFill scene Color/LIGHTGREEN) (.setWidth stage 600) (.setHeight stage 450) (.setScene stage scene) (.setVisible stage true))) (javafxapp) 31
  • 34. Clojure GUI Example (defnjavafxapp[] (let [stage (Stage. "JavaFX Stage") scene (Scene.)] (.setFill scene Color/LIGHTGREEN) (.setWidth stage 600) (.setHeight stage 450) (.setScene stage scene) (.setVisible stage true))) (javafxapp) 32 Create a Function for the Application
  • 35. Clojure GUI Example (defnjavafxapp [] (let [stage (Stage. "JavaFX Stage") scene (Scene.)] (.setFill scene Color/LIGHTGREEN) (.setWidth stage 600) (.setHeight stage 450) (.setScene stage scene) (.setVisible stage true))) (javafxapp) 33 Initialize the Stage and Scene Variables
  • 36. Clojure GUI Example (defnjavafxapp [] (let [stage (Stage. "JavaFX Stage") scene (Scene.)] (.setFill scene Color/LIGHTGREEN) (.setWidth stage 600) (.setHeight stage 450) (.setScene stage scene) (.setVisible stage true))) (javafxapp) 34 Call Setter Methods on Scene and Stage
  • 37. Clojure GUI Example (defnjavafxapp [] (let [stage (Stage. "JavaFX Stage") scene (Scene.)] (.setFillscene Color/LIGHTGREEN) (.setWidthstage 600) (.setHeightstage 450) (.setScenestage scene) (.setVisiblestage true))) (javafxapp) 35 Java Constant Syntax Java Method Syntax
  • 38. Simpler Code Using doto (defnjavafxapp [] (let [stage (Stage. "JavaFX Stage") scene (Scene.)] (doto scene (.setFillColor/LIGHTGREEN)) (doto stage (.setWidth600) (.setHeight450) (.setScene scene) (.setVisibletrue)))) (javafxapp) 36
  • 39. Simpler Code Using doto (defnjavafxapp [] (let [stage (Stage. "JavaFX Stage") scene (Scene.)] (doto scene (.setFillColor/LIGHTGREEN)) (doto stage (.setWidth 600) (.setHeight 450) (.setScene scene) (.setVisible true)))) (javafxapp) 37 doto form: (doto symbol (.method params)) equals: (.method symbol params)
  • 40. Refined Clojure GUI Example (defnjavafxapp [] (doto (Stage. "JavaFX Stage") (.setWidth600) (.setHeight450) (.setScene (doto (Scene.) (.setFillColor/LIGHTGREEN) (.setContent (list (doto (Rectangle.) (.setX25) (.setY40) (.setWidth100) (.setHeight50) (.setFillColor/RED)))))) (.setVisibletrue))) (javafxapp) 38
  • 41. Refined Clojure GUI Example (defnjavafxapp [] (doto(Stage. "JavaFX Stage") (.setWidth 600) (.setHeight 450) (.setScene (doto(Scene.) (.setFillColor/LIGHTGREEN) (.setContent (list (doto (Rectangle.) (.setX 25) (.setY 40) (.setWidth 100) (.setHeight 50) (.setFillColor/RED)))))) (.setVisible true))) (javafxapp) 39 Let replaced with inline declarations
  • 42. Refined Clojure GUI Example (defnjavafxapp [] (doto (Stage. "JavaFX Stage") (.setWidth 600) (.setHeight 450) (.setScene (doto (Scene.) (.setFillColor/LIGHTGREEN) (.setContent (list (doto (Rectangle.) (.setX 25) (.setY 40) (.setWidth 100) (.setHeight 50) (.setFillColor/RED)))))) (.setVisible true))) (javafxapp) 40 Doto allows nested data structures
  • 43. Refined Clojure GUI Example (defnjavafxapp [] (doto (Stage. "JavaFX Stage") (.setWidth 600) (.setHeight 450) (.setScene (doto (Scene.) (.setFillColor/LIGHTGREEN) (.setContent (list (doto (Rectangle.) (.setX 25) (.setY 40) (.setWidth 100) (.setHeight 50) (.setFillColor/RED)))))) (.setVisible true))) (javafxapp) 41 Now a nested Rectangle fits!
  • 44. Closures in Clojure 42 Inner classes can be created using proxy (.addChangeListenerrectRectangle/HOVER (proxy [Listener] [] (handle [b, p] (.setFillrect (if (.isHoverrect) Color/GREEN Color/RED)))))
  • 45. Closures in Clojure Inner classes can be created using proxy 43 Proxy form: (proxy [class] [args] fs+) f => (name [params*] body) (.addChangeListenerrectRectangle/HOVER (proxy[Listener][] (handle [b, p] (.setFillrect (if (.isHoverrect) Color/GREEN Color/RED)))))
  • 47. Features of Groovy Tight integration with Java Very easy to port from Java to Groovy Declarative syntax Familiar to JavaFX Script developers Builders
  • 48. Example 1: Simple FX Script to Groovy
  • 49. Step 1: Lazy conversion to Groovy class HelloStage implements Runnable { void run() { Stage stage = new Stage(); stage.setTitle("Hello Stage (Groovy)“); stage.setWidth(600); stage.setHeight(450); Scene scene = new Scene(); scene.setFill(Color.LIGHTSKYBLUE); stage.setScene(scene); stage.setVisible(true); } static void main(args) { FX.start(new HelloStage()); } }
  • 50. Step 2: Slightly More Groovy class HelloStage implements Runnable { void run() { new Stage( title: "Hello Stage (Groovy)", width: 600, height: 450, visible: true, scene: new Scene( fill: Color.LIGHTSKYBLUE, ) ); } static void main(args) { FX.start(new HelloStage()); } }
  • 51. Slight Aside: Groovy Builders Groovy builders make writing custom DSLs easy For the next slide, I am using a builder I defined Hopefully the community will improve upon this
  • 52. Step 3: Using a Groovy Builder FxBuilder.build { stage = stage( title: "Hello World", width: 600, height: 450, scene: scene(fill: Color.LIGHTSKYBLUE) { ... } ) stage.visible = true; }
  • 53. Step 4: With Content FxBuilder.build { stage = stage( title: "Hello Rectangle (Groovy FxBuilder 2)", width: 600, height: 450, scene: scene(fill: Color.LIGHTSKYBLUE) { rectangle( x: 25, y: 40, width: 100, height: 50, fill: Color.RED ) } ) stage.visible = true; }
  • 54. Example 2: FX Script Animation in Groovy
  • 55. Step 1: JavaFX Script def timeline = Timeline { repeatCount: Timeline.INDEFINITE autoReverse: true keyFrames: [ KeyFrame { time: 750ms values : [ rect1.x => 200.0 tweenInterpolator.LINEAR, rect2.y => 200.0 tweenInterpolator.LINEAR, circle1.radius => 200.0 tweenInterpolator.LINEAR ] } ]; } timeline.play();
  • 56. Step 1a: JavaFX Script Simplification def timeline = Timeline { repeatCount: Timeline.INDEFINITE autoReverse: true keyFrames: at (750ms) { rect1.x => 200.0 tween Interpolator.LINEAR; rect2.y => 200.0 tween Interpolator.LINEAR; circle1.radius => 200.0 tween Interpolator.LINEAR; } } timeline.play();
  • 57. Step 2: Java-ish Groovy Animations final Timeline timeline = new Timeline( repeatCount: Timeline.INDEFINITE, autoReverse: true ) final KeyValue kv1 = new KeyValue (rect1.x(), 200); final KeyValue kv2 = new KeyValue (rect2.y(), 200); final KeyValue kv3 = new KeyValue (circle1.radius(), 200); final KeyFramekf = new KeyFrame(Duration.valueOf(750), kv1, kv2, kv3); timeline.getKeyFrames().add(kf); timeline.play();
  • 58. Step 3: JavaFX Animation Groovy DSL (courtesy of Jim Clarke – work in progress) timeline = timeline(repeatCount: Timeline.INDEFINITE, autoReverse: true) { at 750.ms update values { change rect1.y() to 200 change rect2.x() to 200 change circle.radius() to 200 } } timeline.play();
  • 59. Groovy Closures - With interface coercion def f = { bean, pr-> rect.setFill(rect.isHover() ? Color.GREEN : Color.RED); } as Listener; rect.addChangedListener(Rectangle.HOVER, f);
  • 60. 58 JavaFX With Scala
  • 61. What is Scala Started in 2001 by Martin Odersky Compiles to Java bytecodes Pure object-oriented language Also a functional programming language 59
  • 62. Why Scala? Shares many language features with JavaFX Script that make GUI programming easier: Static type checking – Catch your errors at compile time Closures – Wrap behavior and pass it by reference Declarative – Express the UI by describing what it should look like Scala also supports DSLs! 60
  • 63. Java vs. Scala DSL public class HelloStage implements Runnable { public void run() { Stage stage = new Stage(); stage.setTitle("Hello Stage"); stage.setWidth(600); stage.setHeight(450); Scene scene = new Scene(); scene.setFill(Color.LIGHTGREEN); Rectangle rect = new Rectangle(); rect.setX(25); rect.setY(40); rect.setWidth(100); rect.setHeight(50); rect.setFill(Color.RED); stage.add(rect); stage.setScene(scene); stage.setVisible(true); } public static void main(String[] args) { FX.start(new HelloStage()); } } object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } 61 22 Lines 545 Characters 17 Lines 324 Characters
  • 64. object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } 62
  • 65. 63 object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } Base class for JavaFX applications
  • 66. 64 object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } Declarative Stage definition
  • 67. 65 object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } Inline property definitions
  • 68. 66 object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } List Construction Syntax
  • 69. Animation in Scala def timeline = new Timeline { repeatCount = INDEFINITE autoReverse = true keyFrames = List( new KeyFrame(time: 50) { values = List( new KeyValue(rect1.x() -> 300), new KeyValue(rect2.y() -> 500), new KeyValue(rect2.width() -> 150) ) } ) } 67
  • 70. def timeline = new Timeline { repeatCount = INDEFINITE autoReverse = true keyFrames = List( new KeyFrame(time: 50) { values = List( new KeyValue(rect1.x() -> 300), new KeyValue(rect2.y() -> 500), new KeyValue(rect2.width() -> 150) ) } ) } Animation in Scala 68 Duration set by Constructor Parameter
  • 71. Animation in Scala 69 def timeline = new Timeline { repeatCount = INDEFINITE autoReverse = true keyFrames = List( new KeyFrame(time: 50) { values = List( new KeyValue(rect1.x() -> 300), new KeyValue(rect2.y() -> 500), new KeyValue(rect2.width() -> 150) ) } ) } Operator overloading for animation syntax
  • 72. Closures in Scala 70 Closures are also supported in Scala And they are 100% type-safe rect.addChangedListener(Node.HOVER, (b, p) => { rect.fill = if (rect.hover) Color.GREEN else Color.RED })
  • 73. Closures in Scala Closures are also supported in Scala And they are 100% type-safe 71 rect.addChangedListener(Node.HOVER, (b, p) => { rect.fill = if (rect.hover) Color.GREEN else Color.RED }) Compact syntax (params) => {body}
  • 74. Other JVM Languages to Try Jython Started by Jim Hugunin High Performance Python Mirah Invented by Charles Nutter Originally called Duby Local Type Inference, Static and Dynamic Typing Fantom Created by Brian and Andy Frank Originally called Fan Built-in Declarative Syntax Portable to Java and .NET Local Type Inference, Static and Dynamic Typing 72
  • 75. Fantom Code Example Void main() { Stage { title= "Hello Stage" width= 600 height= 450 Scene { fill= Color.LIGHTGREEN Rectangle { x= 25 y= 40 width= 100 height= 50 fill= Color.RED } } }.open } 73
  • 76. timeline := Timeline { repeatCount = Timeline.INDEFINITE autoReverse = true KeyFrame { time = 50ms KeyValue(rect1.x()-> 300), KeyValue(rect2.y() -> 500), KeyValue(rect2.width() -> 150) } } Animation in Fantom 74 Fantom has a built-in Duration type And also supports operator overloading
  • 77.
  • 78. How about JavaFX on… Visage Stage { title: "Hello Stage" width: 600 height: 450 scene: Scene { fill: Color.LIGHTGREEN content: Rectangle { x: 25 y: 40 width: 100 height: 50 fill: Color.RED } } } 76
  • 79. How about JavaFX on… Visage Stage { title: "Hello Stage" width: 600 height: 450 scene: Scene { fill: Color.LIGHTGREEN content: Rectangle { x: 25 y: 40 width: 100 height: 50 fill: Color.RED } } } 77
  • 80. How about JavaFX on… Visage Stage { title: "Hello Stage" width: 600 height: 450 Scene { fill: Color.LIGHTGREEN Rectangle { x: 25 y: 40 width: 100 height: 50 fill: Color.RED } } } 78
  • 81. Conclusion You can write JavaFX applications in pure Java JavaFX is also usable in alternate languages Over time improved support is possible Groovy Builders, Scala DSL, Visage Remember: This is a proof of concept only – you can not leave this session and do this today.
  • 84. 82 Stephen Chin steveonjava@gmail.com tweet: @steveonjava

Editor's Notes

  1. There are two kinds of listener: ‘changedListener’ and ‘ChangingListener’. Being informed of the change before it happens allow for it to be vetoed.It is also possible to either watch a single property, or all properties belonging to a bean.Note that the value passed to the callback is the old value. This is to ensure that we aren’t eagerly computing the new value when it might not be required. To get the new value, you can call the function on the bean or via the propertyReference
  2. There are two kinds of listener: ‘changedListener’ and ‘ChangingListener’. Being informed of the change before it happens allow for it to be vetoed.It is also possible to either watch a single property, or all properties belonging to a bean.Note that the value passed to the callback is the old value. This is to ensure that we aren’t eagerly computing the new value when it might not be required. To get the new value, you can call the function on the bean or via the propertyReference
  3. There are two kinds of listener: ‘changedListener’ and ‘ChangingListener’. Being informed of the change before it happens allow for it to be vetoed.It is also possible to either watch a single property, or all properties belonging to a bean.Note that the value passed to the callback is the old value. This is to ensure that we aren’t eagerly computing the new value when it might not be required. To get the new value, you can call the function on the bean or via the propertyReference
  4. There are two kinds of listener: ‘changedListener’ and ‘ChangingListener’. Being informed of the change before it happens allow for it to be vetoed.It is also possible to either watch a single property, or all properties belonging to a bean.Note that the value passed to the callback is the old value. This is to ensure that we aren’t eagerly computing the new value when it might not be required. To get the new value, you can call the function on the bean or via the propertyReference
  5. There are two kinds of listener: ‘changedListener’ and ‘ChangingListener’. Being informed of the change before it happens allow for it to be vetoed.It is also possible to either watch a single property, or all properties belonging to a bean.Note that the value passed to the callback is the old value. This is to ensure that we aren’t eagerly computing the new value when it might not be required. To get the new value, you can call the function on the bean or via the propertyReference
  6. There are two kinds of listener: ‘changedListener’ and ‘ChangingListener’. Being informed of the change before it happens allow for it to be vetoed.It is also possible to either watch a single property, or all properties belonging to a bean.Note that the value passed to the callback is the old value. This is to ensure that we aren’t eagerly computing the new value when it might not be required. To get the new value, you can call the function on the bean or via the propertyReference
  7. There are two kinds of listener: ‘changedListener’ and ‘ChangingListener’. Being informed of the change before it happens allow for it to be vetoed.It is also possible to either watch a single property, or all properties belonging to a bean.Note that the value passed to the callback is the old value. This is to ensure that we aren’t eagerly computing the new value when it might not be required. To get the new value, you can call the function on the bean or via the propertyReference
  8. Slight conversion to Groovy. This can be compiled by the Groovy compiler and run, but basically there is only one line difference (the ‘static void main’ line)
  9. This is the same code as the previous slide, taking advantage of some of the Groovy syntax tricks. This is getting to look a lot more like JavaFX Script.
  10. This DSL handles running on the EDT, and can actually be run as-is – there is no need for a class declaration, or anything else to ensure that we’re on the EDT. This is getting us fairly close to the simple JavaFX Script at the beginning
  11. This DSL handles running on the EDT, and can actually be run as-is – there is no need for a class declaration, or anything else to ensure that we’re on the EDT. This is getting us fairly close to the simple JavaFX Script at the beginning