3 Open the Sample FXML File
This chapter shows you how to open the
IssueTrackingLite.fxml sample file in a JavaFX Scene Builder window using the NetBeans IDE Open command or using the Scene Builder Open command.
After you have familiarized yourself with the JavaFX concepts and the JavaFX Scene Builder user interface, begin building an FXML layout using JavaFX Scene Builder. Open the completed
IssueTrackingLite.fxml file to see what the finished IssueTrackingLite GUI layout looks like. Use one of the following methods:
Step through Use NetBeans IDE Projects Window to open the
IssueTrackingLitesample NetBeans project and double-click the node for the IssueTrackingLite.fxml file to invoke JavaFX Scene Builder.
Follow Use JavaFX Scene Builder Open Command to open the
IssueTrackingLite.fxmlsample file in a standalone Scene Builder tool.
The controller source file and the Cascading Style Sheet (CSS) file used in this tutorial are already provided with the IssueTrackingLite sample NetBeans project. These files are in the same project folder that will contain the new FXML file.
Use NetBeans IDE Projects Window
Open the completed
IssueTrackingLite.fxml sample layout file using NetBeans IDE's Projects window:
Start NetBeans IDE on your Windows platform by double-clicking the NetBeans IDE 8.0 shortcut, or select Start, then All Programs, then NetBeans, and finally, NetBeans IDE 8.0. On a Mac OS X platform, double-click the NetBeans IDE 8.0 application icon.
From the Menu bar, select File and then Open Project.
From the Open Project dialog box, go to the directory where you extracted the
IssueTrackingLitesample file and open the IssueTrackingLite project.
In the Projects window, expand the IssueTrackingLite, Source Packages, and issuetrackinglite nodes. Double-click the IssueTrackingLite.fxml node to open the file in JavaFX Scene Builder.
IssueTrackingLite.fxmlfile opens in the IDE source editor instead of in a Scene Builder window, it may mean that the IDE is not aware of your Scene Builder installation. To verify, select Tools from the NetBeans IDE main menu and then Options. In the Options window, click the Java tab and then the JavaFX tab. The Scene Builder Home directory would be listed if NetBeans is aware of your Scene Builder installation. If it is not listed, see Prepare for This Tutorial chapter for the requirements before continuing with this tutorial.
The main window for the JavaFX Scene Builder tool appears with the
IssueTrackingLite.fxmlfile opened in the Content panel, as shown in Figure 3-1.
Figure 3-1 Completed IssueTrackingLite.fxml Opened in JavaFX Scene Builder Window
Description of "Figure 3-1 Completed IssueTrackingLite.fxml Opened in JavaFX Scene Builder Window "
Save the file with a different name so that you can create your own FXML layout file. From the Menu bar, select File and then Save As. Enter
IssueTrackingLiteComplete.fxmlin the File Name text field and click Save. Keep the JavaFX Scene Builder window for this file open so that you can use it to compare with the version of the layout you are about to create.
In the Projects window of the IDE, right-click the node for the IssueTrackingLite.fxml file and select Delete so that you can use the same file name for the FXML layout you will build. On the Confirm Object Deletion dialog box, click Yes.
Use JavaFX Scene Builder Open Command
Open the completed sample FXML file directly from a standalone JavaFX Scene Builder window.
Start JavaFX Scene Builder on your Windows platform by double-clicking the JavaFX Scene Builder 2.0 shortcut, or select Start, then All Programs, then JavaFX Scene Builder, and finally, JavaFX Scene Builder 2.0. On a Mac OS X platform, double-click the JavaFX Scene Builder 2.0 application icon.
From the Menu bar, select File and then Open.
From the Open FXML dialog box, go to the folder in which you extracted the
IssueTrackingLitesample file and open the IssueTrackingLite, src, and issuetrackinglite folders.
Double-click the IssueTrackingLite.fxml file.
IssueTrackingLite.fxmlfile is opened in the Content panel, as shown in Figure 3-1.
Save the file with a different name so that you can create your own FXML layout file using the original file name that is recognized by the IssueTrackingLite application.
From the Menu bar, select File and then Save As.
IssueTrackingLiteComplete.fxmlin the File Name text field and click Save.