Last active
August 29, 2015 14:13
-
-
Save tenntenn/f8c89022f7139a3c15bf to your computer and use it in GitHub Desktop.
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
# build and run | |
$ go build -o /dev/null nashorn-javafx.go && gopherjs build nashorn-javafx.go && jjs -fx nashorn-javafx.js |
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
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