Skip to content

Instantly share code, notes, and snippets.

@ivanarrizabalaga
Created December 19, 2013 16:48
Show Gist options
  • Save ivanarrizabalaga/8042381 to your computer and use it in GitHub Desktop.
Save ivanarrizabalaga/8042381 to your computer and use it in GitHub Desktop.
Mixing a griffon view + swing toolkit + javafx. It does not work, the nodes inside the SceneGraphBuilder are not being recognize as javafx nodes.
package testmixfx
import javafx.embed.swing.JFXPanel
import groovyx.javafx.GroovyFX
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import groovyx.javafx.SceneGraphBuilder;
JFXPanel jfxPanel = new JFXPanel();
def DEFAULT_URL = "http://www.yahoo.com"
application(title: 'testmixfx',
preferredSize: [320, 240],
pack: true,
locationByPlatform: true,
iconImage: imageIcon('/griffon-icon-48x48.png').image,
iconImages: [imageIcon('/griffon-icon-48x48.png').image,
imageIcon('/griffon-icon-32x32.png').image,
imageIcon('/griffon-icon-16x16.png').image]) {
// add content here
panel(id:"myPanel",preferredSize: new Dimension(800,400)){
migLayout(layoutConstraints: 'fill')
label('Content Goes Here',constraints:"wrap")
widget(jfxPanel)
}
Platform.runLater(new Runnable() {
@Override
public void run() {
def sg = new groovyx.javafx.SceneGraphBuilder(true);
jfxPanel.scene = sg.scene(width: 800, height: 400) {
webEngine = webEngine(location: DEFAULT_URL)
webView(engine: webEngine)
}
}
});//-->No signature of method: java.lang.Object.webEngine() is applicable for argument types: (java.util.LinkedHashMap, null) values: [[location:http://www.yahoo.com], null]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment