JavaFX Script (for history)
This language can be used in applets embedded in web pages or Java applications. It is concise and is used to visually define a graphical interface and relate it to application functions.
Based on the F3 language (Form Follow Function), bought out in 2005, Sun developed JavaFX Script, a declarative language designed to describe graphical interfaces, for the JavaFX framework. This language competes with XUL and XAML, but its syntax brings it closer to JavaScript, and the JavaFX framework, version 1.0 of which is released in December 2008, is a competitor to Adobe AIR and Silverlight, other frameworks for web applications .
Designed for GUI development, it has features that allow you to associate components with application data and therefore synchronize the interface with data, and its syntax is five times shorter than that of Java.
He wants to combine enriched text, graphics, animation, audio and video.
2011 update. JavaFX Script is no longer supported with JavaFX 2.0 and should be considered obsolete. Java was resold by Sun Oracle.
Language features
- Types: String, Number, Integer, Boolean, Void, Null, Duration.
- We are not announcing the guy, he is involved in what is appointed. The keyword var or def is useful.
- Operators are Java operators.
- All this expression .
- The object is defined by a literal according to the syntax of the array, for example, in JavaScript.
- The {} characters are used multiple times. They are used to group content, insert a variable into a string (PHP uses the variable directly with its dollar attachment). Connect circuits .
- The same can be written equivalently in declarative and procedural form.
- It can use existing Java classes.
Syntax
Procedural syntax is similar to JavaScript syntax. Declarative syntax uses the JavaFX framework API to simply describe the interface.
Function declaration:
function display() { println("Hello!"); }
No return type:
function display() : Void { println("Hello!"); }
Table:
var myArray = [ 1, 2, 3, 4 ]
JavaFX and JavaFX Script object:
Stage { title: "Déclarer est facile!" width: 320 height: 240 visible: true }
The Stage object allows you to define a window. Add a title and dimensions .
Same written statement in procedural form:
var myStage:Stage = new Stage(); myStage.title = "Déclarer est facile!";
myStage.width = 320;
myStage.height = 240; myStage.visible = true;
Ex-extensive
Hello world!
Stage { scene: Scene { content: Text { font: Font { size: 24 } x: 10 y: 30 content: "Hello World!" } } }
View the contents of the table.
var arr = [ 1, 2, 3, 4, 5] for(x in arr) { println(x); }