Here is some useful information to keep in mind when working with shape operations:
F ShapeIntersect is a diminutive operation where the resulting area is smaller than
the original shapes. This will yield some interesting results when working with large
number of shapes.
F Both ShapeIntersect and ShapeSubtract will automatically apply a union
operation to all shapes assigned to sequence property a . You can omit property
b when you want to apply the union operation.
F ShapeIntersect and ShapeSubtract both generate new shape objects.
Therefore, color, effects, animation, transformation, and binding applied to the
original members of the sets will be lost and will not be applied to the newly
F Creating and using JavaFX sequences
F Drawing simple shapes
Drawing letter shapes using the Text class
Beside geometric shapes (see the recipe Drawing simple shapes ), one of the most
fundamental node types available in JavaFX is the Text node. This node is used to draw
letter shapes on the screen that can be manipulated just like other node types offered by the
JavaFX platform. In this recipe, you will learn how to work with the Text class to display text
on your application's screen.
Before you can draw text using JavaFX, you must know how to create a basic JavaFX
application and know how to add content to the application's scene. To refresh your memory,
see the recipe Building a JavaFX application . To display text, you will need to import the Text
class found in the package javafx.scene.text . That package also contains additional
classes to support text rendering in JavaFX including Font , FontWeight , TextAlignment ,
and TextOrigin .
How to do it...
When drawing text, you simply create a text node and attach it to the scene as shown in
the next listing. You can get full listing of the code in ch02/source-code/src/text/