public List getSelectedBeans ( ) { ArrayList < Object > list = new ArrayList <> ( ) ; int [ ] viewRowIndices = jtable . getSelectedRows ( ) ; for ( int viewRowIndex : viewRowIndices ) { int modelRowIndex = jtable . convertRowIndexToModel ( viewRowIndex ) ; list . add ( beans . get ( modelRowIndex ) ) ; if ( debugSelected ) System . out . println ( " bean selected= " + modelRowIndex + " " + beans . get ( modelRowIndex ) ) ; } return list ; }
Get the currently selected beans . Use this for multiple selection