in src/main/groovy/groovy/swing/TableDemo.groovy [39:65]
void run() {
swing = new SwingBuilder()
frame = swing.frame(title:'Groovy TableModel Demo', location:[200,200], size:[300,200]) {
menuBar {
menu(text:'Help') {
menuItem() {
action(name:'About', closure:{ showAbout() })
}
}
}
panel {
borderLayout()
scrollPane(constraints:CENTER) {
table() {
def model = [['name':'James', 'location':'London'], ['name':'Bob', 'location':'Atlanta'], ['name':'Geir', 'location':'New York']]
tableModel(list:model) {
closureColumn(header:'Name', read:{row -> return row.name})
closureColumn(header:'Location', read:{row -> return row.location})
}
}
}
}
}
frame.show()
}