17 Jul
Groovy SWT – Listener
This is just a small snippet to show you how to add a SWT – Listener without using the Groovy SWTBuilder.
class CompClass extends Composite {
public CompClass(parent, style) {
super(parent, style)
initialize()
}
private initialize() {
Button searchButton = new Button(this, SWT.NONE)
searchButton.setBounds(new Rectangle(0, 0, 60, 25))
searchButton.addListener(SWT.Selection , {
doSomething()
} as Listener)
}
private doSomething(){
println "Hi!"
}
}

