Skip to content

Instantly share code, notes, and snippets.

@tenntenn
Last active August 29, 2015 14:13
Show Gist options
  • Save tenntenn/f8c89022f7139a3c15bf to your computer and use it in GitHub Desktop.
Save tenntenn/f8c89022f7139a3c15bf to your computer and use it in GitHub Desktop.
# build and run
$ go build -o /dev/null nashorn-javafx.go && gopherjs build nashorn-javafx.go && jjs -fx nashorn-javafx.js
package main
import (
"github.com/gopherjs/gopherjs/js"
)
var java = js.Global.Get("Java")
func main() {
js.Global.Set("start", start)
}
func start(stage js.Object) {
stage.Set("title", "Hello, GopherJS")
WebView := java.Call("type", "javafx.scene.web.WebView")
webview := WebView.New()
webview.Call("getEngine").Call("load", "http://gopherjs.org/playground/")
Scene := java.Call("type", "javafx.scene.Scene")
scene := Scene.New(webview, 600, 600)
stage.Call("setScene", scene)
stage.Call("show")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment