Java Reference
In-Depth Information
11. To continue, create a new code package (right-click on the project source directory,
and select New-|-Package), and name the package hello .
12. Next, right-click on the newly created source package and select New-|-Empty-
JavaFX-Script from the context menu, and name it HelloJavaFX.fx .
13. This will do exactly what it says, which is to create an empty code window. Notice,
however, that the editor comes with several code snippets that you can reuse in
your own code.
14. In the Snippets window, shown in the previous screenshot, click on Applications and
double-click on Stage. This will bring up a template editor. Accept the default values
and continue.
Edit the sample code by adding the highlighted portion. You can see the full code listing at
ch01/source-code/src/hello/HelloJavaFX.fx .
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
Stage {
title: " Hello JavaFX "
scene: Scene {
width: 250
height: 200
content: [
Text {
Search WWH ::

Custom Search