-
Notifications
You must be signed in to change notification settings - Fork 4
Console
Normally when you create a stage you supply it with a normal JavaFX Scene. When you're using this library in your project you have another option, the DevScene. The DevScene works similarly to chrome's devtools , it allows you to view and edit your application in real-time.
One of the DevScene's features is a console, which—via java's Nashorn engine—allows you to run ECMAScript (JavaScript) code. But just being able to execute JavaScript code isn't too exciting, you could just open a web browser and do that immediately. What makes the console useful is its ability to interact with your program. This is accomplished in several ways, the first and most useful of which is the variables which exist by default:
| Variable name | Description | Type |
|---|---|---|
| scene | The DevScene which contains your application. | Scene |
| root | Your application's root. This is not the same as the scene's root. | Parent |
| selected | The selected node in the DevTool's structure tab. | Node |
All classes in packages: javafx.scene, javafx.graphics, javafx.controls, javafx.base, and javafx.stage are also imported by default into the console's context.