Java Reference
In-Depth Information
tor
's
Properties
section. By default, Scene Builder opens a dialog showing the
project's source-code folder, which is where you placed the image file
bug.png
in
Section 25.4.3. Select the image file, then click
Open
. Scene Builder displays the
image and resizes the
ImageView
to match the image's aspect ratio—the ratio of
the image's width to its height—by setting the
ImageView
's
Fit Width
and
Fit
Height
properties.
3.
Changing the
ImageView
's size.
We'd like to display the image in its original size.
To do so, you must delete the default values for the
ImageView
's
Fit Width
and
Fit
Height
properties, which are located in the
Inspector
's
Layout
section. Once you
delete these values, Scene Builder resizes the
ImageView
to the image's exact di-
mensions. Save the FXML file.
You've now completed the GUI. Scene Builder's content panel should now appear as
shown in Fig. 25.8.
Fig. 25.8
|
Completed design of the
Welcome
app's GUI in Scene Builder.
You can run the app from NetBeans in one of three ways:
• Select the project's root node in the NetBeans
Projects
window, then click the
Run Project
( ) button on the toolbar.
• Select the project's root node in the NetBeans
Projects
window, then press F6.
• Right click the project's root node in the NetBeans
Projects
window, then select
Run
.
In each case, the IDE will compile the app (if it isn't already compiled), then run the app.
The
Welcome
app should now appear as shown in Fig. 25.2.