This is just a diary.

Monday, October 5, 2009

Scala swing - listening to Table selection events

I'm now trying to learn a new programming language - Scala.

It took me ages to figure out what's going on with the table selection events. Unfortunatelly there does not seem to be any good and free documentation available to cover scala.dbc or scala.swing packages.

The relevant bits of code to react to cell selection events are provided below:
import swing._
import event._

object topicsTable extends Table()

listenTo(topicsTable.selection)

reactions += {
case TableRowsSelected(`topicsTable`, range, adjusting) => {
println(topicsTable.selection.cells)
}
}

No comments: