Java Reference
In-Depth Information
How it works...
Before you can get your application to run, you must import the correct packages into your
script. To display visual objects on the screen, you must, at a minimum, have the following
two packages:
F javafx.stage.Stage
F javafx.scene.Scene
These packages contain the base classes Stage and Scene that are required to create a
windowed area to display visual content of a JavaFX application. Other packages used in this
recipe include the following:
F javafx.scene.paint.Color —the Color class is used to apply color to visual
components when rendered. The paint package also contains effects such as linear
and radial gradients (see Chapter 3 , Transformation, Animations, and Effects ).
F javafx.scene.text.Font —this class specifies a font and its attributes used for
the Text component (see next bullet). The text package contains all other supporting
text-related classes used for rendering textual shapes.
F javafx.scene.text.Text —the Text class is used to render text as shapes on
the screen. The text package contains all other supporting text-related classes used
for rendering textual shapes.
F javafx.scene.shape.Rectangle —this class is part of the larger collection of
shapes offered by the Shape API. It represents a rectangular shape.
Decomposing the application
The JavaFX framework expects application content to be organized as a hierarchical stack of
Stage → Scene → Node (Tree), with Stage being the outer-most container. The next image
shows how these high-level components are organized on the desktop.
 
Search WWH ::




Custom Search