Java Reference
In-Depth Information
The second hand, minute hand, and hour hand are the lines created in linesĀ 114-139. The
paintClock()
method places all these shapes in the pane using the
addAll
method in a list
(line 142). Because the
paintClock()
method is invoked whenever a new property (
hour
,
minute
,
second
,
w
, and
h
) is set (lines 27, 38, 49, 60, 71, 82, 95), before adding new contents
into the pane, the old contents are cleared from the pane (line 141).
K
EY
T
ERMS
AWT 536
bidirectional binding
property getter method
543
544
primary stage
537
bindable object
542
shape 539
Swing 536
value getter method
binding object
542
binding property
542
543
JavaFX 536
node 539
observable object
value setter method
543
UI control 539
unidirectional binding
542
544
pane
539
C
HAPTER
S
UMMARY
1.
JavaFX is the new framework for developing rich Internet applications. JavaFX com-
pletely replaces Swing and AWT.
2.
A main JavaFX class must extend
javafx.application.Application
and imple-
ment the
start
method. The primary stage is automatically created by the JVM and
passed to the
start
method.
3.
A stage is a window for displaying a scene. You can add nodes to a scene. Panes, con-
trols, and shapes are nodes. Panes can be used as the containers for nodes.
4.
A binding property can be bound to an observable source object. A change in the source
object will be automatically reflected in the binding property. A binding property has a
value getter method, value setter method, and property getter method.
5.
The
Node
class defines many properties that are common to all nodes. You can apply
these properties to panes, controls, and shapes.
6.
You can create a
Color
object with the specified red, green, blue components, and
opacity value.
7.
You can create a
Font
object and set its name, size, weight, and posture.
8.
The
javafx.scene.image.Image
class can be used to load an image and this image
can be displayed in an
ImageView
object.
9.
JavaFX provides many types of panes for automatically laying out nodes in a desired loca-
tion and size. The
Pane
is the base class for all panes. It contains the
getChildren()
method to return an
ObservableList
. You can use
ObservableList
's
add(node)
and
addAll(node1, node2, ...)
methods for adding nodes into a pane.
Search WWH ::
Custom Search