Java Reference
In-Depth Information
width: 400
height: 100
scene: Scene {
content: Text {
x: 10
y: 20
content: "Hello World"
}
}
}
Save this to MyFirstApp.fx, then compile using the
javafxc
command. (Make
sure the SDK bin directory is in your command path.)
$ javafxc MyFirstApp.fx
$
This produces one or more class files in the current directory. Next, run the first
program by using the
javafx
command:
$ javafx MyFirstApp
If all goes well, you should see something similar to Figure 1.8.
There you have it: your first JavaFX Script application. You are now ready to
move on to more interesting content.
The
javafxc
compiler command is very similar to the
javac
compiler com-
mand. Accordingly, the
javafxc
command uses the same format and options as
the Java compiler command. The basic format of the
javafxc
command is
$ javafxc <options> <source files>
Figure 1.8
JavaFX SDK Hello World
Search WWH ::
Custom Search