« Return to Thread: swingbuilder - linking actions to events

Re: swingbuilder - linking actions to events

by Andres Almiray :: Rate this Message:

Reply to Author | View in Thread

Yes, that has to do with Swing's complexity issues. Many components accept an Action property, they also are ActionListeners, meaning that actionPerformed is available via reflection.

You would like to use action: when the intent is to reuse an Action object across two or more components, otherwise actionPerformed: is the way to go.

Cheers,
Andres

Glen Pepicelli wrote:
 I see something that was confusing me... there is both an "action" and "actionperformed".. you can; tpass a closure directly to "action" but you can with "actionperformed":

                    menuBar() {
                        menu (text: "Debug") {
                        menuItem(text: "Open Debug Window")
                                        menuItem(text: "hello", actionPerformed: {println "hi!!"})
                        }
                    }

Glen

 « Return to Thread: swingbuilder - linking actions to events