Created
December 19, 2013 16:42
-
-
Save ivanarrizabalaga/8042308 to your computer and use it in GitHub Desktop.
Mixing a griffon view + swing toolkit + javafx.
It works, but you're not using a builder for the javafx nodes.
This file contains 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 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() { | |
final WebView browser = new WebView(); | |
final WebEngine webEngine = browser.getEngine(); | |
webEngine.load(DEFAULT_URL); | |
Scene s = new Scene(browser); | |
jfxPanel.setScene(s); | |
webEngine.reload(); | |
} | |
});//--> it works, but it's quite UGLY, no dsl no fun. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment