JavaFX Script
Encyclopedia
JavaFX Script is a scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

 designed by Sun Microsystems
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

, forming part of the JavaFX
JavaFX
JavaFX is a software platform for creating and delivering rich Internet applications that can run across a wide variety of connected devices....

 family of technologies on the Java Platform.

JavaFX targets the Rich Internet Application
Rich Internet application
A Rich Internet Application is a Web application that has many of the characteristics of desktop application software, typically delivered either by way of a site-specific browser, via a browser plug-in, independent sandboxes, extensive use of JavaScript, or virtual machines...

 domain (competing with Adobe Flex
Adobe Flex
Adobe Flex is a software development kit released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform...

 and Microsoft Silverlight
Microsoft Silverlight
Microsoft Silverlight is an application framework for writing and running rich Internet applications, with features and purposes similar to those of Adobe Flash. The run-time environment for Silverlight is available as a plug-in for web browsers running under Microsoft Windows and Mac OS X...

), specializing in rapid development of visually rich applications for the desktop and mobile markets. JavaFX Script works with integrated development environment
Integrated development environment
An integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...

s such as NetBeans
NetBeans
NetBeans refers to both a platform framework for Java desktop applications, and an integrated development environment for developing with Java, JavaScript, PHP, Python, Groovy, C, C++, Scala, Clojure, and others...

 and Eclipse
Eclipse (software)
Eclipse is a multi-language software development environment comprising an integrated development environment and an extensible plug-in system...

. JavaFX is released under the GNU General Public License
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....

, 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
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

 employee through their acquisition of SeeBeyond Technology Corporation
SeeBeyond Technology Corporation
SeeBeyond Technology Corporation was a software company listed on the NASDAQ stock market . On 28 June 2005 the sale of the company for $387m to Sun Microsystems was announced; the deal was completed by August...

 in September 2005.

Its name was changed to JavaFX Script, and it became open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

d at JavaOne
JavaOne
JavaOne is an annual conference inaugurated in 1996 by Sun Microsystems to discuss Java technologies, primarily among Java developers. JavaOne is held in San Francisco, California typically running from Monday to Thursday. Technical sessions on a variety of topics are held during the day. In the...

 2007.

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

On September 10, 2010 Oracle announced at JavaOne
JavaOne
JavaOne is an annual conference inaugurated in 1996 by Sun Microsystems to discuss Java technologies, primarily among Java developers. JavaOne is held in San Francisco, California typically running from Monday to Thursday. Technical sessions on a variety of topics are held during the day. In the...

 that JavaFX Script would be discontinued, although the JavaFX API would be made available to other languages for the Java Virtual Machine.

On September 27, 2010 Stephen Chin announced Visage a declarative user-interface language based on the JavaFX script with enhancements.

Features

JavaFX Script is a compiled, statically typed, declarative, scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

 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
JavaFX
JavaFX is a software platform for creating and delivering rich Internet applications that can run across a wide variety of connected devices....

 APIs it supports retained mode
Retained mode
In computing, retained mode rendering is a style for application programming interfaces of graphics libraries, in which the libraries retain a complete model of the objects to be rendered.-Overview:...

 vector graphics, video playback and standard Swing
Swing (Java)
Swing is the primary Java GUI widget toolkit. It is part of Oracle's Java Foundation Classes — an API for providing a graphical user interface for Java programs....

 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
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 classes in JavaFX Script code. Compiled JavaFX Script is able to run on any platform which has a recent Java Runtime installed.

Syntax

JavaFX
JavaFX
JavaFX is a software platform for creating and delivering rich Internet applications that can run across a wide variety of connected devices....

 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
Swing (Java)
Swing is the primary Java GUI widget toolkit. It is part of Oracle's Java Foundation Classes — an API for providing a graphical user interface for Java programs....

 directly.

Here is a simple Hello world program
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

 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"
}
}
}

It shows the following window/frame :



This program can also be written in this way:

import javafx.ext.swing.*;

var myFrame:SwingFrame = new SwingFrame;
var myLabel:Label = new Label;

myLabel.text = "Hello World!";
myFrame.width = 200;
myFrame.height = 50;
myFrame.visible = true;
myFrame.content = myLabel;

Prerequisites

Java SE 5 or above is required to support JavaFX Script development. Developers may work with JavaFX Script using the Eclipse
Eclipse (software)
Eclipse is a multi-language software development environment comprising an integrated development environment and an extensible plug-in system...

 or NetBeans
NetBeans
NetBeans refers to both a platform framework for Java desktop applications, and an integrated development environment for developing with Java, JavaScript, PHP, Python, Groovy, C, C++, Scala, Clojure, and others...

 IDEs by incorporating the necessary plugins.

See also

  • Java applet
    Java applet
    A Java applet is an applet delivered to users in the form of Java bytecode. Java applets can run in a Web browser using a Java Virtual Machine , or in Sun's AppletViewer, a stand-alone tool for testing applets...

    , a means of deploying Java applications inside a web page.
  • JavaFX
    JavaFX
    JavaFX is a software platform for creating and delivering rich Internet applications that can run across a wide variety of connected devices....

    , a family of products and technologies intended to be used to create Rich Internet Applications (RIAs)
    Rich Internet application
    A Rich Internet Application is a Web application that has many of the characteristics of desktop application software, typically delivered either by way of a site-specific browser, via a browser plug-in, independent sandboxes, extensive use of JavaScript, or virtual machines...

    .
  • Swing
    Swing (Java)
    Swing is the primary Java GUI widget toolkit. It is part of Oracle's Java Foundation Classes — an API for providing a graphical user interface for Java programs....

    , the underlying user interface library employed by JavaFX Script.
  • Curl (programming language), also with a declarative mode with optional typing

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK