Created
May 31, 2009 19:51
-
-
Save aalmiray/121006 to your computer and use it in GitHub Desktop.
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
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