Last active
September 30, 2017 22:57
-
-
Save mikehearn/bccd66cde507d12ea85e6a4842d75008 to your computer and use it in GitHub Desktop.
Hello World in JavaFX using Nashorn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run like this: jjs -fx hello.js | |
load("fx:base.js"); | |
load("fx:controls.js"); | |
load("fx:graphics.js"); | |
// Set the title bar. | |
$STAGE.title = "Hello World!"; | |
// Create a button and place it in a layout that will center it. | |
var button = new Button(); | |
button.text = "Say 'Hello World'"; | |
button.onAction = function() print("Hello World!"); | |
var root = new StackPane(); | |
root.children.add(button); | |
// Make a small window to contain it all and show. | |
$STAGE.scene = new Scene(root, 300, 250); | |
$STAGE.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment