Java Reference
In-Depth Information
The
Library
contains JavaFX
Containers
,
Controls
and other items that can be dragged
and dropped on the canvas
You use the
content panel to
design the GUI
You use the
Inspector
window to
configure the currently selected item in
the content panel
The
Hierarchy
window shows the structure of the
GUI and allows you to select and reorganize controls
Fig. 25.7
|
JavaFX Scene Builder displaying the default GUI in
Welcome.fxml
.
to these controls—for this app, there will not be any such code, so you can click
Delete
to
remove these controls.
Deleting the Reference to the
WelcomeController
Class
As you'll learn in Section 25.5, in Scene Builder, you can specify the name of the controller
class that contains methods for responding to the user's interactions with the GUI. The
Welcome
app does not need to respond to any user interactions, so you'll remove the ref-
erence in the FXML file to class
WelcomeController
. To do so, select the
AnchorPane
node in the
Hierarchy
window, then click the
Inspector
window's
Code
section to expand
it and delete the value specified in the
Controller class
field. You're now ready to create the
Welcome
app's GUI.
For this app, you'll place a
Label
and an
ImageView
in a
VBox
layout container
(package
javafx.scene.layout
), which will be the scene graph's root node. Layout containers help
you arrange and size GUI components. A
VBox
arranges its nodes
vertically
from top to
bottom.
VBox
is one of several JavaFX layout containers for arranging controls in a GUI.
We discuss the
GridPane
layout container in Section 25.5 and several others in online
Chapter 26. By default, NetBeans provides an
AnchorPane
as the root layout. To change
from the default
AnchorPane
to a
VBox
: