code: private void setListSelection(int selectedIndex) {
          if (selectedIndex == -1) {
              list.clearSelection();
          } else {
              list.setSelectedIndex(selectedIndex);
              list.ensureIndexIsVisible(selectedIndex);
          }
      }
docs: Sets the list selection index to the selectedIndex. This method is used
  to synchronize the list selection with the combo box selection.
  
  @param selectedIndex the index to set the list