Thursday, June 3, 2010

JavaFX

I'm writing this blog to people who wants to know what JavaFX is, and this will be a good starting point for many.
This blog is in a breaf format without wasting time.

JavaFX Script is tool that will enable developers to create rich content(Rich User Interface) using the JavaFX family of products from Sun Microsystems.

Power and simplicity of using JavaFX Script is to create rich internet applications that will run on many different platforms, including personal computers and mobile phones. This can give content designers and application developers a simple, but powerful, language that has all the capability of Java behind it. For example, in JavaFX Script a simple declarative expression can define a user interface complete with platform-independent layout managers. Behind-the-scenes, Java facilities such as layout managers and Swing components are automatically employed to implement the desired user interface. The JavaFX product family currently consists of two technologies: JavaFX Mobile and JavaFX Script. JavaFX Script is a fully object-oriented language. JavaFX code can fully utilize the Java libraries. Much of the user interface (UI) capability of JavaFX makes use of the Java Swing classes behind the scenes.
JavaFX enables fast development of application prototypes. JavaFX is a competitive alternative for Flex(by Adobe) and Silverlight(by Microsoft).

Simple javaFX example (HelloJFX.fx)
package jfx_first; // package declaration
     import javafx.ui.*;
     import javafx.ui.canvas.*; //import statements
     Frame { //Frame is a pure java class
         title: "Hello World-style example for JavaFX Script"
         height: 100
         width: 400 // title, height, width are attributes
        content:
              Canvas {
                  content:
                  Text {
                      font:
                      Font {
                             faceName: "Sans Serif"
                             style: BOLD
                             size: 24
                      }
                      x: 10
                      y: 10
                      content: "Hello JavaFX Script Developer!"
             }
           }                   
           visible: true       // Show the Frame on the screen
}

The line comment describes you how javaFX code is built.

No comments:

Post a Comment