Originally posted by Gregg Bolinger:
But Brian, won't that only show you the selected row(s)? I think Sharon needs the row that lost focus. I am assuming she just needs to keep track of that herself?
Pretty much yes. You can actually query the ListSelectionEvent for the range of rows that may have changed [via e.getFirstIndex() and e.getLastIndex()] and can ask the table [via yourTable.isRowSelected() or other ways] if each row in the range is selected. Depending on your needs you can sometimes treat the selected rows in the range as new selections and unselected rows in the range as new deselections, but it's certainly possible that some of the rows in the middle of the range have not changed selection state. To get things perfect you have to keep track of the rows yourself somehow. If you're going to be doing this a lot you may want to create a custom subclass of DefaultListSelectionModel.
[edit: custom subclass of DefaultListSelectionModel, not ListSelectionModel since that's an interface]
[ January 01, 2008: Message edited by: Brian Cole ]