Skip to content

Instantly share code, notes, and snippets.

@jagedn
Created April 2, 2017 10:09
Show Gist options
  • Save jagedn/3ebc5a11f16743c7362b836827ffe3ce to your computer and use it in GitHub Desktop.
Save jagedn/3ebc5a11f16743c7362b836827ffe3ce to your computer and use it in GitHub Desktop.
groovyfx as script
import groovy.grape.Grape
new javafx.embed.swing.JFXPanel();
Grape.grab(group:'org.groovyfx',module:'groovyfx',version:'8.0.0',transitive:false)
Class.forName('groovyx.javafx.GroovyFX').start {
stage(title: 'GroovyFX Hello World', visible: true) {
scene(fill: BLACK, width: 500, height: 250) {
hbox() {
text(text: 'Groovy', font: '80pt sanserif') {
fill linearGradient(endX: 0, stops: [PALEGREEN, SEAGREEN])
}
text(text: 'FX', font: '80pt sanserif') {
fill linearGradient(endX: 0, stops: [CYAN, DODGERBLUE])
effect dropShadow(color: DODGERBLUE, radius: 25, spread: 0.25)
}
}
}
}
}
@jagedn
Copy link
Author

jagedn commented Sep 20, 2024

pffff 7 years ago it did ;)

yes, still works but you need to use very old versions of java+groovy

sdk install java 8.0.422.fx-zulu
sdk use java 8.0.422.fx-zulu
sdk install groovy 3.0.11
sdk use groovy 3.0.11
groovy run hello.groovy

don't know your idea/requirements but GroovyFX is not maintained (last commit was 3 years ago...)

@ambastos
Copy link

I will try just to see if it works at least once! Thanks for the answer...

@ambastos
Copy link

Yes, I'll try a bit more, but it works only with java 8 and groovy 3. One version more, neither (java or groovy) works...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment