private void updateButtons(){
  boolean favoriteSelected=false;
  boolean nonFavoriteSelected=false;
  for (  String game : list.getSelectedValuesList()) {
    if (favorites.contains(game)) {
      favoriteSelected=true;
    }
 else {
      nonFavoriteSelected=true;
    }
  }
  addToFavoritesButton.setEnabled(nonFavoriteSelected);
  removeFromFavoritesButton.setEnabled(favoriteSelected);
}

private void updateButtons ( ) { boolean favoriteSelected = false ; boolean nonFavoriteSelected = false ; for ( String game : list . getSelectedValuesList ( ) ) { if ( favorites . contains ( game ) ) { favoriteSelected = true ; } else { nonFavoriteSelected = true ; } } addToFavoritesButton . setEnabled ( nonFavoriteSelected ) ; removeFromFavoritesButton . setEnabled ( favoriteSelected ) ; }
sets the state of the favorites buttons depending on the current selection .
