Skip to content

Instantly share code, notes, and snippets.

@Dierk
Created January 1, 2017 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dierk/b8c9fc6470a42e27d12eea02b7848f9c to your computer and use it in GitHub Desktop.
Save Dierk/b8c9fc6470a42e27d12eea02b7848f9c to your computer and use it in GitHub Desktop.
GroovyFX: factory methods for a composite view
import static groovyx.javafx.GroovyFX.start
/**
Demo of using methods to create multiple nodes (here Buttons) as a composite view and use those
factory methods multiple times.
@author Dierk Koenig
*/
start {
sgb = delegate
stage title: 'Multiple Buttons', visible: true, {
scene {
hbox {
threeVerticalButtons(sgb, 1, 4, 7)
threeVerticalButtons(sgb, 2, 5, 8)
threeVerticalButtons(sgb, 3, 6, 9)
}
}
}
}
def threeVerticalButtons(sgb, l1, l2, l3) {
sgb.vbox {
button l1
button l2
button l3
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment