public static <T> int moveSelectedItemsUp(@NotNull JList<T> list) {
    ListModel<T> model = list.getModel();
    ListModelExtension<T, ListModel<T>> extension = getExtension(model);
    int[] indices = list.getSelectedIndices();
    if (!canMoveSelectedItemsUp(list)) return 0;
    for (int index : indices) {
      T temp = extension.get(model, index);
      extension.set(model, index, extension.get(model, index - 1));
      extension.set(model, index - 1, temp);
      list.removeSelectionInterval(index, index);
      list.addSelectionInterval(index - 1, index - 1);
    }
    Rectangle cellBounds = list.getCellBounds(indices[0] - 1, indices[indices.length - 1] - 1);
    if (cellBounds != null) {
      list.scrollRectToVisible(cellBounds);
    }
    return indices.length;
  }
public static <T> int moveSelectedItemsUp(@NotNull JList<T> list)