swingbuilder - linking actions to events
Hi all,
How do I attach a Action to one of the many events swing has besides the obvious ones that are referred to by "action" in swingbuilder?
I figured out (by guessing) one way below but my syntax "windowClosing: exit.closure" seems a little odd. I wanted to make sure there isn't another syntax.
def exit= builder.action(
name:'Exit', closure: {System.exit(0)}
)
def frame=
builder.frame(
title:'Catalog',
windowClosing: exit.closure,
size: [screenWidth -50, screenHeight -50],
location: [19,4],
show: true,
)
{
menuBar() {
menu(text: "File", mnemonic: 'F') {
menuItem(text: "Exit", mnemonic: 'X', action: exit )
}
}
}
Thanks!
Glen