Skip to content

Instantly share code, notes, and snippets.

@aalmiray
Created May 31, 2009 19:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalmiray/121006 to your computer and use it in GitHub Desktop.
Save aalmiray/121006 to your computer and use it in GitHub Desktop.
import groovy.beans.Bindable
import groovy.swing.SwingBuilder
class Foo {
@Bindable Bar bar
}
class Bar {
@Bindable String baz
}
def foo = new Foo()
foo.bar = new Bar()
def swing = new SwingBuilder()
swing.edt {
frame( title: "Binding", size: [200,140], visible: true ) {
gridLayout(cols: 1, rows: 3)
textField(id: "t1", text: bind{foo.bar.baz})
textField(id: "t2")
button("Sync!", actionPerformed:{ foo.bar.baz = t2.text})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment