Using the ScenicView tool to study JavaFX scenegraph
ScenicView is a great tool made and supported by one of the JavaFX developers, Jonathan Giles. It can be downloaded from http://fxexperience.com/scenic-view/.
ScenicView benefits from open JavaFX architecture and the SceneGraph paradigm. It allows the traversing SceneGraph of any JavaFX application to run on the same machine and check the properties of every Node.
Working with ScenicView is very simple:
- Run your JavaFX application
- Call java -jar scenicView.jar
ScenicView will automatically find your app and show its structure in a window like the following:
On the left, you can see the scenegraph, and on the right, you can review all properties of the selected node.
Note how the boundsInParent and layoutBounds properties are additionally marked right inside your application:
The next feature is node detection; by clicking Ctrl + Shift + S, ScenicView will detect which node is located at the mouse coordinates, provide a brief description, and select it in the ScenicView on click:
This feature provides immense value while debugging complex JavaFX applications.