SlideShare a Scribd company logo
Scripting with Java FX
Agenda
What is Java FX?
Why Java FX?
The 10 Minute Tutorial
Java FX Demo!
What To Do/Where To Go
Introduction: What is Java FX?
“JavaFX Script is a highly productive scripting language that
enables content developers to create rich media and content
for deployment on Java environments. JavaFX Script is a
declarative, statically-typed programming language. It has firstclass functions, declarative syntax, list-comprehensions, and
incremental dependency-based evaluation. It can make direct
calls to Java APIs that are on the platform.”
--https://openjfx.dev.java.net/
Why Java FX?
• Writing GUIs is hard (and annoying)
> Yes, Matisse helps quite a bunch, but...
> There are still too many listeners.
Why Java FX?
• Writing GUIs is hard (and annoying)
> Yes, Matisse helps quite a bunch, but...
> There are still too many listeners.

• GUIs by default are ugly
> A hierarchy of rectangular “grey boxes” (not limited to Java!)
> Not as snazzy as Flash websites
Why Java FX?
• Writing GUIs is hard (and annoying)
> Yes, Matisse helps quite a bunch, but...
> There are still too many listeners.

• GUIs by default are ugly
> A hierarchy of rectangular “grey boxes” (not limited to Java!)
> Not as snazzy as Flash websites

• Java 2D provides much what is needed, but...
> It is rather difficult to use for this purpose
> It does not have “compositional” behavior

Java FX's declarative syntax, combining Swing-like user-interface
widgets with compositional, Java 2D-like functionality makes writing
flashy graphical user interfaces easy!
Java FX: The 10 Minute Tutorial
class HelloWorldModel {
attribute saying: String;
}

Class definition with
single String attribute

var model = HelloWorldModel {
saying: "Hello Campus"
};

Instance of the class
called “model” which
initializes string

var win = Frame {
title: bind "{model.saying} JavaFX"
width: 200
content: TextField {
value: bind model.saying
}
visible: true
};

Frame with a single
text field. Frame's title
and text field's value is
bound to model's
attribute.
Java FX: The 10 Minute Tutorial
import java.lang.StringIndexOutOfBoundsException;

Defining

operation substring(s:String, n:Number): String { operations (i.e.
try {
methods)
return s.substring(n);
} catch (e:StringIndexOutOfBoundsException) {
throw “sorry, index out of bounds”;
}
}

Calling Java methods
Can throw any object
you like
Java FX: The 10 Minute Tutorial
var x = [1,2,3];
insert 10 into x;
insert 12 before x[1];
delete x[. == 12];
delete x[. >= 3];
insert 5 after x[. == 1];
insert 13 as first into x;
delete x;

Array Initialization
yields [1, 2, 3, 10]
yields [1, 12, 2, 3, 10]
yields [1, 2, 3, 10]
yields [1, 2]
yields [1, 5, 2]
yields [13, 1, 5, 2]
yields []

function factors(n) {
return select i from i in [1..n/2] where n % i == 0;
}

Database-like Queries
for Arrays!
Java FX: The 10 Minute Tutorial
class X {
attribute nums: Number*;
}
trigger on new X {
insert [3,4] into this.nums;
}

Object creation trigger
Array insertion trigger
Array replacement
trigger

trigger on insert num into X.nums {
System.out.println("just inserted {num} into X.nums at
position {indexof num}");
}
trigger on X.num[oldValue] = newValue {
System.out.println("X.num: just replaced {oldValue} with
{newValue}");
}
Java FX: The 10 Minute Tutorial
import javafx.ui.canvas.*;
import javafx.ui.*;

Canvas object for
arbitrary drawing

Canvas {
content: Group {
transform: [rotate(20,0,0)]
content:
[Rect {
x: 20
y: 20
height: 80
width: 300
...
},
Ellipse {
cx: 150
cy: 80
...
},
}]
}
}

Group objects together
Transform groups
Declarative 2D
Graphics
demo
Java FX

What to
Do

• Download Java FX & IDE
Plugins for Netbeans or
Eclipse
• Join OpenJFX Java.net
Project
• Do Java FX Tutorials
• Participate on Java FX
Forums
• Create something cool!

http://openjfx.dev.java.net
Java FX Resources
• Java FX Project Site: http://openjfx.dev.java.net
> Java.net: Download early versions of Java FX
> IDE Plugins, Tutorials, Forums, FAQs
> “Getting Started With the JavaFX Script Language”
> “JavaFX Script 2D Graphics Tutorial”
> “The JavaFX Script Programming Language Reference”

• Planet FX Wiki: http://jfx.wikia.com/wiki/Main_Page
> Open-source documentation site for Java FX

• Chris Oliver's Blog: http://blogs.sun.com/chrisoliver/
> Latest news, other informal information
> Source code for lots of demos (Space Invaders, Calculator)

• Sun's Java FX Site:
http://www.sun.com/software/javafx/
> Sun Microsystems official product page
Scripting with Java FX
http://openjfx.dev.java.net

THANK YOU!

More Related Content

PDF
Node Architecture and Getting Started with Express
PDF
Performance Optimization and JavaScript Best Practices
PDF
Intro to node.js - Ran Mizrahi (28/8/14)
PDF
Advanced JavaScript - Internship Presentation - Week6
ODP
Asynchronous I/O in NodeJS - new standard or challenges?
PDF
Tech friday 22.01.2016
PDF
JavaScript OOPs
PDF
Douglas Crockford: Serversideness
Node Architecture and Getting Started with Express
Performance Optimization and JavaScript Best Practices
Intro to node.js - Ran Mizrahi (28/8/14)
Advanced JavaScript - Internship Presentation - Week6
Asynchronous I/O in NodeJS - new standard or challenges?
Tech friday 22.01.2016
JavaScript OOPs
Douglas Crockford: Serversideness

What's hot (19)

PDF
Intro To JavaScript Unit Testing - Ran Mizrahi
PDF
JavaScript 101
PDF
JavaScript Basics and Best Practices - CC FE & UX
PPTX
Lecture 5 javascript
PPTX
Object Oriented Programming In JavaScript
PPTX
Type script, for dummies
ODP
Object Oriented Javascript
PDF
JavaScript - Chapter 8 - Objects
PDF
PPTX
002. Introducere in type script
PDF
Java Script Best Practices
PPTX
Nashorn: JavaScript that doesn’t suck (ILJUG)
PPTX
Typescript tips & tricks
PPTX
JavaScript in Object-Oriented Way
PPTX
Introduction to Node.js
PDF
Introduction to nodejs
PPTX
All You Need to Know About Type Script
PDF
All aboard the NodeJS Express
PPTX
Advanced Javascript
Intro To JavaScript Unit Testing - Ran Mizrahi
JavaScript 101
JavaScript Basics and Best Practices - CC FE & UX
Lecture 5 javascript
Object Oriented Programming In JavaScript
Type script, for dummies
Object Oriented Javascript
JavaScript - Chapter 8 - Objects
002. Introducere in type script
Java Script Best Practices
Nashorn: JavaScript that doesn’t suck (ILJUG)
Typescript tips & tricks
JavaScript in Object-Oriented Way
Introduction to Node.js
Introduction to nodejs
All You Need to Know About Type Script
All aboard the NodeJS Express
Advanced Javascript
Ad

Similar to Scripting with Java FX - Cédric Tabin - December 2007 (20)

ODP
JavaFX introduction
ODP
Java Fx Overview Tech Tour
ODP
Presentation - Course about JavaFX
PDF
Node.js vs Play Framework (with Japanese subtitles)
ODP
EuRuKo JRuby Talk 2008
PPTX
The Java Fx Platform – A Java Developer’S Guide
PDF
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
PPTX
JavaFX and Scala in the Cloud
PDF
Don't panic in Fortaleza - ScalaFX
PPT
Intro to JavaFX & Widget FX
PDF
Scala in a nutshell
PDF
Scala and jvm_languages_praveen_technologist
PDF
Spring Day | Spring and Scala | Eberhard Wolff
PDF
Why Node.js
PDF
Why Nodejs Guilin Shanghai
PPTX
Core java over view basics introduction by quontra solutions
PPTX
JavaFX 2.0 With Alternative Languages [Portuguese]
PDF
4 JVM Web Frameworks
PDF
Rich Internet Applications con JavaFX e NetBeans
PDF
Java Interview Questions for 10+ Year Experienced PDF By ScholarHat
JavaFX introduction
Java Fx Overview Tech Tour
Presentation - Course about JavaFX
Node.js vs Play Framework (with Japanese subtitles)
EuRuKo JRuby Talk 2008
The Java Fx Platform – A Java Developer’S Guide
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX and Scala in the Cloud
Don't panic in Fortaleza - ScalaFX
Intro to JavaFX & Widget FX
Scala in a nutshell
Scala and jvm_languages_praveen_technologist
Spring Day | Spring and Scala | Eberhard Wolff
Why Node.js
Why Nodejs Guilin Shanghai
Core java over view basics introduction by quontra solutions
JavaFX 2.0 With Alternative Languages [Portuguese]
4 JVM Web Frameworks
Rich Internet Applications con JavaFX e NetBeans
Java Interview Questions for 10+ Year Experienced PDF By ScholarHat
Ad

More from JUG Lausanne (20)

PDF
Introduction aux algorithmes génétiques
PDF
Développer un moteur d'exécution symbolique en partant de rien
PDF
Reverse engineering Java et contournement du mécanisme de paiement inapp Android
PDF
Exemple d'IOT et ML avec Android, Cassandra et Spark
PDF
Play! chez Zaptravel - Nicolas Martignole - December 2012
PDF
Playframework Realtime Web - Guillaume Bort & Sadek Drobi - December 2012
PDF
CloudBees - Sacha Labourey - May 2011
PDF
Apache Camel - Stéphane Kay - April 2011
PDF
Session dédiée à l'analyse de la qualité du code Java - Cyril Picat - Februar...
PDF
OpenDS - Ludovic Poitou - December 2010
PDF
Spring Batch - Julien Jakubowski - November 2010
PDF
Infinispan - Galder Zamarreno - October 2010
PDF
No Sql - Olivier Mallassi - September 2010
PDF
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
PDF
Introduction à Scala - Michel Schinz - January 2010
PDF
Introduction Groovy / Grails - Cyril Picat - December 2009
PDF
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009
PDF
Sonar - Freddy Mallet - April 2009
PDF
Maven2 - Philippe Kernevez - March 2009
PDF
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009
Introduction aux algorithmes génétiques
Développer un moteur d'exécution symbolique en partant de rien
Reverse engineering Java et contournement du mécanisme de paiement inapp Android
Exemple d'IOT et ML avec Android, Cassandra et Spark
Play! chez Zaptravel - Nicolas Martignole - December 2012
Playframework Realtime Web - Guillaume Bort & Sadek Drobi - December 2012
CloudBees - Sacha Labourey - May 2011
Apache Camel - Stéphane Kay - April 2011
Session dédiée à l'analyse de la qualité du code Java - Cyril Picat - Februar...
OpenDS - Ludovic Poitou - December 2010
Spring Batch - Julien Jakubowski - November 2010
Infinispan - Galder Zamarreno - October 2010
No Sql - Olivier Mallassi - September 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Introduction à Scala - Michel Schinz - January 2010
Introduction Groovy / Grails - Cyril Picat - December 2009
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009
Sonar - Freddy Mallet - April 2009
Maven2 - Philippe Kernevez - March 2009
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Spectroscopy.pptx food analysis technology
PPT
Teaching material agriculture food technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Network Security Unit 5.pdf for BCA BBA.
Empathic Computing: Creating Shared Understanding
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
Review of recent advances in non-invasive hemoglobin estimation
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
sap open course for s4hana steps from ECC to s4
Spectroscopy.pptx food analysis technology
Teaching material agriculture food technology
Per capita expenditure prediction using model stacking based on satellite ima...
20250228 LYD VKU AI Blended-Learning.pptx

Scripting with Java FX - Cédric Tabin - December 2007

  • 2. Agenda What is Java FX? Why Java FX? The 10 Minute Tutorial Java FX Demo! What To Do/Where To Go
  • 3. Introduction: What is Java FX? “JavaFX Script is a highly productive scripting language that enables content developers to create rich media and content for deployment on Java environments. JavaFX Script is a declarative, statically-typed programming language. It has firstclass functions, declarative syntax, list-comprehensions, and incremental dependency-based evaluation. It can make direct calls to Java APIs that are on the platform.” --https://openjfx.dev.java.net/
  • 4. Why Java FX? • Writing GUIs is hard (and annoying) > Yes, Matisse helps quite a bunch, but... > There are still too many listeners.
  • 5. Why Java FX? • Writing GUIs is hard (and annoying) > Yes, Matisse helps quite a bunch, but... > There are still too many listeners. • GUIs by default are ugly > A hierarchy of rectangular “grey boxes” (not limited to Java!) > Not as snazzy as Flash websites
  • 6. Why Java FX? • Writing GUIs is hard (and annoying) > Yes, Matisse helps quite a bunch, but... > There are still too many listeners. • GUIs by default are ugly > A hierarchy of rectangular “grey boxes” (not limited to Java!) > Not as snazzy as Flash websites • Java 2D provides much what is needed, but... > It is rather difficult to use for this purpose > It does not have “compositional” behavior Java FX's declarative syntax, combining Swing-like user-interface widgets with compositional, Java 2D-like functionality makes writing flashy graphical user interfaces easy!
  • 7. Java FX: The 10 Minute Tutorial class HelloWorldModel { attribute saying: String; } Class definition with single String attribute var model = HelloWorldModel { saying: "Hello Campus" }; Instance of the class called “model” which initializes string var win = Frame { title: bind "{model.saying} JavaFX" width: 200 content: TextField { value: bind model.saying } visible: true }; Frame with a single text field. Frame's title and text field's value is bound to model's attribute.
  • 8. Java FX: The 10 Minute Tutorial import java.lang.StringIndexOutOfBoundsException; Defining operation substring(s:String, n:Number): String { operations (i.e. try { methods) return s.substring(n); } catch (e:StringIndexOutOfBoundsException) { throw “sorry, index out of bounds”; } } Calling Java methods Can throw any object you like
  • 9. Java FX: The 10 Minute Tutorial var x = [1,2,3]; insert 10 into x; insert 12 before x[1]; delete x[. == 12]; delete x[. >= 3]; insert 5 after x[. == 1]; insert 13 as first into x; delete x; Array Initialization yields [1, 2, 3, 10] yields [1, 12, 2, 3, 10] yields [1, 2, 3, 10] yields [1, 2] yields [1, 5, 2] yields [13, 1, 5, 2] yields [] function factors(n) { return select i from i in [1..n/2] where n % i == 0; } Database-like Queries for Arrays!
  • 10. Java FX: The 10 Minute Tutorial class X { attribute nums: Number*; } trigger on new X { insert [3,4] into this.nums; } Object creation trigger Array insertion trigger Array replacement trigger trigger on insert num into X.nums { System.out.println("just inserted {num} into X.nums at position {indexof num}"); } trigger on X.num[oldValue] = newValue { System.out.println("X.num: just replaced {oldValue} with {newValue}"); }
  • 11. Java FX: The 10 Minute Tutorial import javafx.ui.canvas.*; import javafx.ui.*; Canvas object for arbitrary drawing Canvas { content: Group { transform: [rotate(20,0,0)] content: [Rect { x: 20 y: 20 height: 80 width: 300 ... }, Ellipse { cx: 150 cy: 80 ... }, }] } } Group objects together Transform groups Declarative 2D Graphics
  • 12. demo
  • 13. Java FX What to Do • Download Java FX & IDE Plugins for Netbeans or Eclipse • Join OpenJFX Java.net Project • Do Java FX Tutorials • Participate on Java FX Forums • Create something cool! http://openjfx.dev.java.net
  • 14. Java FX Resources • Java FX Project Site: http://openjfx.dev.java.net > Java.net: Download early versions of Java FX > IDE Plugins, Tutorials, Forums, FAQs > “Getting Started With the JavaFX Script Language” > “JavaFX Script 2D Graphics Tutorial” > “The JavaFX Script Programming Language Reference” • Planet FX Wiki: http://jfx.wikia.com/wiki/Main_Page > Open-source documentation site for Java FX • Chris Oliver's Blog: http://blogs.sun.com/chrisoliver/ > Latest news, other informal information > Source code for lots of demos (Space Invaders, Calculator) • Sun's Java FX Site: http://www.sun.com/software/javafx/ > Sun Microsystems official product page
  • 15. Scripting with Java FX http://openjfx.dev.java.net THANK YOU!