Articles‎ > ‎Technical Articles‎ > ‎

Java Fx

posted Aug 11, 2009, 9:36 AM by Thiyagaraaj M   [ updated Aug 16, 2009, 9:27 PM ]

Java Fx Overview:

JavaFX is a software platform for creating and delivering rich Internet applications that can run across wide variety of connected devices. The current release (JavaFX 1.2, June 2009) enables building applications for desktop, browser and mobile phones. TV set-top boxes, gaming consoles, Blu-ray players and other platforms are planned.

JavaFX is fully integrated with the Java Runtime Environment (JRE) – JavaFX applications will run on any desktop and browser that runs the JRE and on top of mobile phones running Java ME.

To build JavaFX apps developers use a statically typed, declarative language called JavaFX Script.

On desktop, the current release supports Windows XP, Windows Vista and Mac OS operating systems. Beginning with JavaFX 1.2 Sun has released beta-releases for Linux and OpenSolaris.

On mobile, JavaFX is capable of running on multiple mobile operating systems, including Android, Windows Mobile, and proprietary real-time operating systems.


JavaFx Scirpt

The JavaFX family of products features a high-performance declarative scripting language, JavaFX Script, for building and delivering the next generation of rich Internet applications for desktop, mobile, TV, and other consumer platforms.

JavaFX Platform Components


The JavaFX platform contains cross-platform and platform-specific runtime environments and support libraries. It includes a declarative language called JavaFX Script, as well as a set of development and design tools. This ensures that applications can provide a consistent look and feel across devices with diverse form factors and capabilities.

Current release of JavaFX platform includes the following components:
   1. The JavaFX SDK: JavaFX compiler and runtime tools. Graphics, media web services, and rich text libraries
   2. NetBeans IDE for JavaFX: NetBeans with drag-and-drop palette to add objects with transformations, effects and animations plus set of samples and best practices. For Eclipse users there is a community-supported plugin hosted on Project Kenai
   3. Tools and plugins for creative tools (a.k.a. Production Suite): Plugins for Adobe Photoshop and Adobe Illustrator that can export graphics assets to JavaFX Script code, tools to convert SVG graphics into JavaFX Script code and preview assets converted to JavaFX from other tools
Commentators have speculated JavaFX to compete on the desktop with Adobe Flash Player, Adobe AIR, OpenLaszlo, and Microsoft Silverlight.

Technical Highlights Of JavaFx

Common profile. JavaFX is based on the concept of a “Common profile” that is intended to span across all devices supported by JavaFX. This approach makes it possible for developers to use a common programming model while building an application targeted for both desktop and mobile devices and to share much of the code, graphics assets and content between desktop and mobile versions. To address the need for tuning applications for the needs of specific class of devices, the JavaFX 1.1 platform includes APIs that are desktop or mobile-specific. For example JavaFX Desktop profile includes Swing and advanced visual effects.

Drag-to-Install. From the point of view of the end user “Drag-to-Install” allows them to drag a JavaFX widget or application residing in a website within the browser window and drop it onto their desktop. The application will not lose its state or context even after the browser is closed. An application can also be re-launched by clicking on a shortcut that gets automatically created on the user's desktop. This behavior is enabled out-of-the-box by the Java applet mechanism and is leveraged by JavaFX from the underlying Java layer. Sun touts “Drag-to-Install” as opening up of a new distribution model and allowing developers to “break away from the browser”.

Integrating graphics created with third-party tools. JavaFX includes a set of plug-ins for Adobe Photoshop and Illustrator that enable advanced graphics to be integrated directly into JavaFX applications. The plug-ins generate JavaFX Script code that preserves layers and structure of the graphics. Developers can then easily add animation or effects to the static graphics imported. There is also an SVG graphics converter tool (a.k.a. Media Factory) that allows for importing graphics and previewing assets after the conversion to JavaFX format.

Why the JavaFX Platform?

Developers are seeking the most efficient way of creating expressive content in applications that appear on desktops, on the Internet, and on mobile devices. They need to build high-fidelity GUI's that operate seamlessly on multiple Web browsers, operating systems and devices, without having to port or rewrite their applications for each screen. To meet this goal, developers need to work efficiently with team members such as graphics designers and media authors to exchange audio, video, and other rich media assets.

The JavaFX platform contains an essential set of tools and technologies that enable developers and designers to collaborate, create, and deploy applications with expressive content to browsers and desktops. Mobile application developers can use the JavaFX Mobile Emulator to preview applications for mobile devices using the JavaFX platform.

Key features of the JavaFX platform


  • One-stop-shop expressive content design and development platform for all screens:Build engaging visual experiences across desktop, browser and mobile with a unified development and deployment model. The most powerful and pervasive platform in the industry is now the most expressive!

  • Broadest market reach: Devices can open up to the broadest portfolio of content and services in the industry. Applications can be distributed across billions of devices with the power of Java. Mobile developers can efficiently target their content to as many mobile devices as possible.

  • Broadest access to mobile device capabilities: JavaFX is the best way to bring expressive, feature-rich content to mobile devices. JavaFX Mobile brings expressiveness to Java ME, to combine the richest mobile experience with the most access to the underlying system and across the broadest number of devices.

  • Lower implementation cost: Builds on your pre-existing investment in Java. Developers can use any Java library within a JavaFX application to build expressive interfaces. In mobile devices, JavaFX builds on top of the existing Java ME and Mobile Service Architecture (MSA) platforms to reduce implementation costs for device manufacturers.

  • Designer-developer workflow: Dramatically shorten your production cycle for design and development by using JavaFX Production Suite to incorporate multimedia assets from popular third-party design tools.

  • Powerful runtime: Leverage the extreme ubiquity, power, performance and security of the Java runtime.

  • Break free from the browser: With Java SE 6 update 10 and beyond, you can drag-to-Install applications from your browser directly onto your desktop. This innovative feature is an industry first and providers developers with new channels to get their content to their target end users.

JavaFX Platform Tools

The available downloads are organized by the functionality you need to start developing with JavaFX. The diagram shows the download bundles, and the following sections contain a detailed description of what each download bundle includes.

Developer Bundle

The developer bundle contains the following tools.

  • NetBeans IDE for JavaFX

    The JavaFX technology is integrated with the NetBeans IDE, a mature and powerful development environment that makes it easy to build, preview, and debug JavaFX applications.

    The NetBeans IDE for JavaFX is easy to learn, and it comes bundled with the JavaFX SDK and lots of sample applications.

    The NetBeans editor features a drag and drop palette to quickly add JavaFX statements, including transformations, effects and animation.

  • JavaFX Plugin for NetBeans

    If you are already using the NetBeans IDE, you can add the JavaFX plugin to include support for developing JavaFX applications.

Designer Bundle

The designer bundle consists of JavaFX Production Suite, a single download that contains the following tools to enable designers to exchange visual assets with developers.



JavaFX Plugin for Adobe Photoshop and JavaFX Plugin for Adobe Illustrator
Plugins for Adobe Photoshop and Adobe Illustrator export graphic assets from creative designer tools to the JavaFX format.

Developers can start building their applications based on mockups that the designer creates. As the visual design evolves, it is easy for the developer to incorporate changes in the artwork for the final version of their application.

When designers save their graphic to the JavaFX format they can compare how the graphic will look in desktop and mobile applications, and they can view metrics that enable them to minimize resource demands on mobile devices.
  • JavaFX Media Factory


    JavaFX Media Factory contains two separate tools:

    • SVG Converter: Convert SVG graphics into the JavaFX format 

    • JavaFX Graphics Viewer: View graphic assets that were converted to the JavaFX format. JavaFX Graphics Viewer allows you to preview each graphic as it will appear in either desktop or mobile applications.

Stand-alone SDK

If you prefer using other tools, or developing directly via the command line, you can download the stand-alone SDK.

  • JavaFX SDK

    The SDK includes the following components (also included when you download NetBeans IDE for JavaFX 

    • JavaFX Desktop Runtime
    • JavaFX Mobile Emulator (for Windows)
    • JavaFX APIs
    • JavaFX Compiler
    • JavaFX API documentation
    • Samples

Features  & Benefits Of JavaFx

The JavaFX Rich Client platform and tools suite offers distinct advantages to Web Developers, Web Designers and Java Developers who are building rich, connected experiences.

JavaFX 1.2 SDKIncludes the JavaFX compiler and runtime tools, graphics, media, Web services, and rich text libraries to create RIAs for the desktop, browser and mobile platforms

NetBeans IDE 6.5.1 for JavaFX 1.2
  • Provides a sophisticated integrated development environment for building, previewing, and debugging JavaFX applications
  • Features a drag-and-drop palette to quickly add JavaFX objects with transformations, effects and animation
  • Provides a set of building blocks samples and the beta version of the JavaFX Mobile Emulator, a mobile phone simulator

JavaFX 1.2 Production SuiteA suite of tools and plug-ins for creative tools that allows graphical assets to be exported to JavaFX applications. The suite consists of:
  • JavaFX 1.2 plug-ins for creative tools—A set of plugins for Adobe Photoshop and Adobe Illustrator that can export graphics assets from the creative designer tools to JavaFX Script code
  • JavaFX 1.2 Media Factory—A set of tools to convert SVG graphics into JavaFX Script code and preview graphics assets converted to JavaFX from other tools. Includes sample applications, tutorials, articles, API documentation, and sample code

Expanded System SupportEarly access to runtime and tools on OpenSolaris and Linux platforms

Expressive RIA platform for all screensProvides unified development and deployment model for building expressive RIAs across desktop, browser and mobile

Designer-developer workflowDramatically shortens production cycle for designers and developers

Powerful runtimeEnables developers to leverage the extreme ubiquity, power, performance and security of Java runtime

A ready-made mass marketWidely distribute RIAs quicker and easier across billions of devices

Drag-and drop capabilitiesEasily drag-and-drop a JavaFX application from the browser to deploy to the desktop

Rich client platformMakes it easy and intuitive to integrate graphics, video, audio, animation, and rich text

Broad system accessUnlike other Web technologies, JavaFX applications get broader system access with the proven Java security model

Ability to preserve investment in JavaReuse existing Java libraries in JavaFX applications

Web services supportAllows rapid development of mash-ups and enterprise applications

Cross-browser compatibilityJavaFX applications look and feel consistent across all browsers on multiple platforms

Enterprise integrationRapidly integrate rich client UI with complex back-end enterprise applications

Advanced rich-text rendering with multi-lingual supportCreate RIAs with global reach

JavaFx Script Features

  • JavaFX Script uses a declarative syntax for specifying GUI components, so a developer's code closely matches the actual layout of the GUI
  • Through declarative databinding and incremental evaluation, JavaFX Script enables developers to easily create and configure individual components by automatically synchronizing application data and GUI components
  • JavaFX Script will work with all major IDEs, including NetBeans, which is the reference implementation IDE for Java development
  • Unlike many other Java scripting languages, JavaFX Script is statically typed and will have most of the same code structuring, reuse, and encapsulation features that make it possible to create and maintain very large programs in Java
  • JavaFX Script is capable of supporting GUIs of any size or complexity
  • JavaFX Script makes it easier to use Swing, one of the best GUI development toolkits of its kind

Example Program Of JavaFx Script

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

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;

JavaFx Licensing

here are currently various licenses for the modules that compose the JavaFX runtime:
  • The core JavaFX runtime is still proprietary software and its code has not yet been released to the public,[5]
  • The JavaFX compiler[6] and an older version of the 2D Scene graph[7] are released under a GPL v2 license,
  • The NetBeans plugin for JavaFX is dual licensed under GPL v2 and CDDL.[5]
During development, Sun explained they will roll out their strategy for the JavaFX licensing model for JavaFX first release[8]. After the release, Jeet Kaul, Sun's Vice president for Client Software, explained that they will soon publish a specification for JavaFX and its associated file formats, and will continue to open source the JavaFX runtime, and decouple this core from the proprietary parts licensed by external partie.

Download Here

http://javafx.com/downloads/all.jsp

Sources:
http://www.sun.com/software/javafx/script/
http://java.sun.com/javafx/
http://www.sun.com/software/javafx/features.xml
http://javafx.com/about/overview/
http://javafx.com/learn/
http://en.wikipedia.org/wiki/JavaFX
http://www.ibm.com/developerworks/java/library/j-javafx/
http://en.wikipedia.org/wiki/JavaFX_Script
http://java.sun.com/javafx/1/tutorials/core/modifiers/
http://javafx.com/docs/gettingstarted/javafx/

Articles