Java Reference
In-Depth Information
The javafx.scene package contains some classes that you'll use often:
The
Scene class is the second level of the UI containment hierarchy for JavaFX applications.
It includes all of the UI elements contained in the application. These elements are called
graphical nodes, or simply nodes.
The
Node class is the base class of all of the graphical nodes in JavaFX. UI elements such as
text, images, media, shapes, and controls (e.g., text boxes and buttons) are all subclasses of
Node . Take a moment to look at the variables and functions in the Node class to appreciate the
capabilities provided to all of its subclasses, including bounds calculation and mouse and
keyboard event handling.
The
Group class is a subclass of the Node class. Its purpose includes grouping nodes together
into a single coordinate space and allowing transforms (e.g., rotate) to be applied to the whole
group. Also, attributes of the group that are changed (e.g., opacity) apply to all of the nodes
contained within the group.
Several packages begin with javafx.scene that contain subclasses of Node of various types. Examples include the
following:
The
javafx.scene.image package contains the Image and ImageView classes, which enable
images to be displayed in the Scene . The ImageView class is a subclass of Node .
The
javafx.scene.shape package contains several classes for drawing shapes such as Circle ,
Rectangle , Line , Polygon , and Arc . The base class of the shapes, named Shape , contains an
attribute named fill that enables you to specify a color, pattern, or gradient with which to fill
the shape.
The
javafx.scene.text package contains the Text class for drawing text in the scene. The
Font class enables you to specify the font name and size of the text.
The
javafx.scene.media package has classes that enable you to play media. The MediaView
class is a subclass of Node that displays the media.
The
javafx.scene.chart package has classes that help you easily create area, bar, bubble,
line, pie, and scatter charts. The corresponding UI classes in this package are AreaChart ,
BarChart , BubbleChart , LineChart , PieChart , and ScatterChart .
Here are some other packages in the JavaFX 8 API.
javafx.scene.control package contains several UI controls, each one having the ability
to be skinned and styled via CSS.
The
javafx.scene.transform package enables you to transform nodes (scale, rotate,
translate, shear, and affine).
The
javafx.scene.input package contains classes such as MouseEvent and KeyEvent that
provide information about these events from within an event handler function such as the
Node class's onMouseClicked event.
The
javafx.scene.layout package contains several layout containers, including HBox , VBox ,
BorderPane , FlowPane , StackPane , and TilePane .
The
javafx.scene.effect package contains easy-to-use effects such as Reflection , Glow ,
Shadow , BoxBlur , and Lighting .
The
Search WWH ::




Custom Search