Scene Builder Setup Guide
Table of Contents:
- Part 1: Install Scene Builder
- Part 2: [Eclipse] Add Scene Builder
- Part 3: [Eclipse] Create and Edit
FXML-file - Part 4: [IntelliJ] Add Scene Builder
- Part 5: [IntelliJ] Create and Edit
FXML-file - Part 6: [VSCode]
Contact Benjamin Bogø if you found a problem or have suggestions for improvements/additions.
Note: Scene Builder on MacOS might not open FXML-files properly.
1 Install Scene Builder
1.1 Install Scene Builder
First, you have to download the Scene Builder installer from this page (it is the same webpage that maintains JavaFX): https://gluonhq.com/products/scene-builder/ . Choose the one for you OS and install the program. If you are not using an IDE, then you are done. Otherwise, enter the path to the installation folder (chosen during the installation - at least on Windows) below:
Input: Path to the folder containing the Scene Builder Application.
2 [Eclipse] Add Scene Builder
2.1 Open File Association
In Eclipse, go to Window > Preferences (MacOS: Eclipse > Preferences). Search for file and choose General > Editors > File Associations.
2.2 Add *.fxml Extension
Click on the topmost button on the right and type in *.fxml. Finish by clicking . If it already exists, then just continue to the next step.
2.3 Add Associated Editor
Make sure to select *.fxml in the File types box (top one). Then click on the bottommost button on the right. In the new dialog, select External programs and then click on . Find the folder to Scene Builder (), select the Scene Builder Application (Windows: SceneBuilder.exe, MacOS: SceneBuilder.dmg) and click on . Now, at the bottom, you should see something called SceneBuilder (the icon may be confusing). Select it and click . In case you want to use it as default editor, you can select SceneBuilder in the bottommost field and click on on the right. Finish by clicking .
3 [Eclipse] Create and Edit FXML-file
3.1 Create FXML-file
It is assumed that you have an open Java project (otherwise see the Setup JavaFX Guide). Right-click on the folder where you want to create the file. In the dropdown, choose New > File (or New > Other... and then in the dialog General > File). Choose the folder in the top box for the file (in case it is not as expected) and give it a File name (ex: filename.fxml) at the bottom. Click on .
3.2 Edit FXML-file
If you have chosen Scene Builder as default, simply double click on the FXML-file to open it in Scene Builder. Otherwise, right-click on the file and in the dropdown choose Open With > Scene Builder. If you want to open it as plain text, right-click on the file and choose Open With > Text Editor in the dropdown.
Note: In case the file is already open in Eclipse (at text file), either use the second option above or close the file to use the first option above.
4 [IntelliJ] Add Scene Builder
This will add an option to right click on a file and open it in Scene Builder.
NOTE: IntelliJ does NOT support opening files in external programs as default.
4.1 Open External Tools
It is assumed that you already have a project open in IntelliJ. In the top menu, choose File > Settings. In the left sidebar, open Tools > External Tools.
4.2 Add Scene Builder
In the left side (in the top), click on the . In the new small dialog, enter the following:
Nameshould beScene Builder.Programshould be the absolute path to Scene Builder Application (Windows:SceneBuilder.exe, MacOS:SceneBuilder.dmg) in the folder.Argumentsshould be$FilePath$.
Finish by clicking on in the small dialog. Afterwards, make sure to click on in the large dialog before clicking on !
5 [IntelliJ] Create and Edit FXML-file
5.1 Create FXML-file
It is assumed that you have an open Java project (otherwise see the Setup JavaFX Guide). Right-click on the folder where you want to create the file. In the dropdown, choose New > File and enter a filename (ex: filename.fxml) in the small dialog. Hit the Enter button when you are done.
5.2 Edit FXML-file
To open the FXML-file in Scene Builder, right click on it and in the dialog choose External Tools > Scene Builder. If you want to open it as plain text, you simply have to open as usual in IntelliJ.
6 [VSCode]
VSCode does not have a built-in way to do this, so you have to open the file in your file system (right-click on file and in the dropdown choose Reveal in File System) and then open it with scene builder. Otherwise, you will need to install an extension for a different behavior.