In Groovy SwingBuilder, how can I close the JTable closure that fires when a cell is selected?

I have a JTable that is being created through Groovy's SwingBuilder. I would like to attach a closure to a table that fires when a cell is selected, but I cannot find the correct hook.

How to do it?

+2


source to share


1 answer


I'm not an expert in groovy, but when inside a swingbuilder table item you can use the Groovy way interfaces . This works because the ListSelectionListener only has one method.



table(id: 'myTable') {
    myTable.selectionModel.addListSelectionListener({evt->
            println("selection changed")
        } as ListSelectionListener)
    }

      

+3


source







All Articles