protected void removeSelected(){
  if (table.getRowCount() == 0) {
    return;
  }
  int viewIndex=table.getSelectedRow();
  int modelIndex=indexToModel(viewIndex);
  if (modelIndex == -1) {
    return;
  }
  T removedItem=data.remove(modelIndex);
  if (table.getRowCount() > viewIndex) {
    setRowSelected(viewIndex);
  }
 else   if (viewIndex - 1 >= 0 && table.getRowCount() > viewIndex - 1) {
    setRowSelected(viewIndex - 1);
  }
  updateButtons();
  if (listener != null) {
    listener.itemRemoved(removedItem);
  }
}

protected void removeSelected ( ) { if ( table . getRowCount ( ) == 0 ) { return ; } int viewIndex = table . getSelectedRow ( ) ; int modelIndex = indexToModel ( viewIndex ) ; if ( modelIndex == - 1 ) { return ; } T removedItem = data . remove ( modelIndex ) ; if ( table . getRowCount ( ) > viewIndex ) { setRowSelected ( viewIndex ) ; } else if ( viewIndex - 1 >= 0 && table . getRowCount ( ) > viewIndex - 1 ) { setRowSelected ( viewIndex - 1 ) ; } updateButtons ( ) ; if ( listener != null ) { listener . itemRemoved ( removedItem ) ; } }
remove the selected entry . if no entry is selected , nothing is done . after removing , an appropriate remaining entry is selected .
