Java Reference
In-Depth Information
Node
Shape
Text
Line
Rectangle
Circle
Ellipse
Arc
Polygon
Polyline
F IGURE 14.25
A shape is a node. The Shape class is the root of all shape classes.
The getter and setter methods for property values
and a getter for property itself are provided in the class,
but omitted in the UML diagram for brevity.
javafx.scene.text.Text
-text: StringProperty
-x: DoubleProperty
-y: DoubleProperty
-underline: BooleanProperty
-strikethrough: BooleanProperty
-font: ObjectProperty<Font>
Defines the text to be displayed.
Defines the x-coordinate of text (default 0 ).
Defines the y-coordinate of text (default 0 ).
Defines if each line has an underline below it (default false ).
Defines if each line has a line through it (default false ).
Defines the font for the text.
+Text()
+Text(text: String)
+Text(x: double, y: double,
text: String)
Creates an empty Text.
Creates a Text with the specified text.
Creates a Text with the specified x-, y-coordinates and text.
F IGURE 14.26
Text defines a node for displaying a text.
(getWidth(), 0)
(0, 0)
(x, y)
text is displayed
(getWidth(), getHeight())
(0, getHeight())
(a) Text(x, y, text)
(b) Three Text objects are displayed
F IGURE 14.27
A Text object is created to display a text.
L ISTING 14.14
ShowText.java
1 import javafx.application.Application;
2 import javafx.scene.Scene;
3 import javafx.scene.layout.Pane;
4 import javafx.scene.paint.Color;
5 import javafx.geometry.Insets;
 
 
Search WWH ::




Custom Search