public static boolean isIndexFullyVisible(@NotNull JList<?> list, int index) {
    int first = list.getFirstVisibleIndex();
    int last = list.getLastVisibleIndex();

    if (first < 0 || last < 0 || index < first || index > last) {
      return false;
    }
    if (index > first && index < last) {
      return true;
    }

    return list.getVisibleRect().contains(list.getCellBounds(index, index));
  }
public static boolean isIndexFullyVisible(@NotNull JList<?> list, int index)