Skip to content

Instantly share code, notes, and snippets.

@mikehearn

mikehearn/hello.js

Last active Sep 30, 2017
Embed
What would you like to do?
Hello World in JavaFX using Nashorn
// 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
You can’t perform that action at this time.