News:

Build a stunning handcrafted website with IT Acumens

Main Menu

JavaFX Script

Started by sukishan, Jul 15, 2009, 02:10 PM

Previous topic - Next topic

sukishan

JavaFX Script is a scripting language designed by Sun Microsystems, forming part of the JavaFX family of technologies on the Java Platform. JavaFX targets the Rich Internet Application domain (competing with Adobe Flex and Microsoft Silverlight), specializing in rapid development of visually rich applications for the desktop and mobile markets. JavaFX Script works with integrated development environments such as NetBeans and Eclipse. JavaFX is released under the GNU General Public License, via the Sun sponsored OpenJFX project

History
JavaFX Script used to be called F3 for Form Follows Function. F3 was primarily developed by Chris Oliver, who became a Sun employee through their acquisition of SeeBeyond Technology Corporation in September 2005.

Its name was changed to JavaFX Script, and it became open sourced at JavaOne 2007.

All the code, documentation and demos are shared in the Project OpenJFX Development Website. JavaFX 1.0 was released on December 4, 2008.

Features

JavaFX Script is a compiled, statically typed, declarative, scripting language for the Java Platform. It provides automatic data-binding, mutation triggers and declarative animation, using an expression language syntax (all code blocks potentially yield values.)

Through its standard JavaFX APIs it supports retained mode vector graphics, video playback and standard Swing components.

Although F3 began life as an interpreted language, prior to the first preview release (Q3 2008) JavaFX Script had shifted focus to being predominantly compiled. Interpreted JavaFX Script is still possible, via the JSR 223 'Scripting for Java' bridge. Because it is built on top of the Java Platform, it is easy to use Java classes in JavaFX Script code. Compiled JavaFX Script is able to run on any platform which has a recent Java Runtime installed.

Syntax

JavaFX Script's declarative syntax for constructing user interfaces contrasts sharply with the more verbose series of method calls required to construct an equivalent interface in Swing directly.

Here is a simple Hello world program for JavaFX Script :

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
Stage {
    title: "Hello World"
    width: 250
    height: 80
    scene: Scene {
        content: Text {
            font : Font {
                size : 24
            }
            x: 10, y: 30
            content: "Hello World"
        }
    }
}
A good beginning makes a good ending