Java Reference
In-Depth Information
Table 11-1.
The List of Nashorn Script Files and the Classes/Packages That They Import
Nashorn Script File
Imported Classes/Packages
fx:base.js
javafx.stage.Stage
javafx.scene.Scene
javafx.scene.Group
javafx/beans
javafx/collections
javafx/events javafx/util
fx:graphics.js
javafx/animation
javafx/application
javafx/concurrent
javafx/css
javafx/geometry
javafx/print
javafx/scene
javafx/stage
fx:controls.js
javafx/scene/chart
javafx/scene/control
fx:fxml.js
javafx/fxml
fx:web.js
javafx/scene/web
fx:media.js
javafx/scene/media
fx:swing.js
javafx/embed/swing
fx:swt.js
javafx/embed/swt
The following snippet of code shows how to load this script file and use the simple
name of the
javafx.scene.control.Label
class:
// Import all JavaFX control class names
load("fx:controls.js")
// Use the simple name of the Label control
var msg = new Label("Hello JavaFX!");
Listing 11-7 contains the code for a JavaFX greeter application that is saved in a file
named
greeter.js
. You can run the script as follows:
jjs -fx greeter.js
Search WWH ::
Custom Search