Getting Start with JavaFX Platform
JavaFX is created by James L.(Jim)Weaver, WeiQi Gao, Stephen Chin, and Dean Iverson. The goal of JavaFX platform is to have one language that works for desktop, the web browser, and mobile devices. JavaFX Script is a declarative language with a Java like syntax. It contains some appealing futures designed to simplify Graphical User Interface (GUI) programming.
Obtaining JavaFX SDK
We will use the NetBeans IDE to run our JavaFX programs. The NetBeans IDE can be obtain from the java.sun.com, and for the JavaFX API we can look at http://java.sun.com/javafx/1/docs/api/. I'll not go over how to use the NetBeans IDE.
Note: If you are having problem with using the NetBeans IDE, you can post questions on my forum under JavaFX section.
Displaying a Simple Window

Click here to
download the example
The above example, we import the package stage so we can use its API. Stage is the frame of the window. Whenever we want to create a frame we have to use the stage API. The code is very short, we set the title of the frame, and the size of it. Notice, it's a little bit different than GUI's from java, we don't not need to set the window to be true for it to be visible.
Displaying Text Inside the Window

Click here to
download the example
The above example, we import two new packages the scene and scene.text package. Whenever we want to display something such as image or text we will need the scene API, and by importing the scene.text we are able to use the text API. If we want to display a text on the window, we need to use the content. In addition to that we have to specify a value for our y-axis, because the default value of y-axis does not allow us to see the text. So the above example is pretty short, we use the scene API so we are able to display on the window, then we use the text API to display text on the window and we are using the keyword content to print to the screen.
Declaring Variables
The two declaring variables in JavaFX are var and def. Var may be assign new values through out the script. Def variables remain constant at their first assign value.
def x = 100;
def y = 200;
var total;
total = x + y;
Here, we declare three variables. Two with def and one with var. Note: we need to specify a for def variables whereas var variables we have the choice to specify an initial value or just leave it as it is. Var variable can hold anything String, integer, double, float, char, byte, or long. As we go through different section, we would see more about def and var.