public static int getHoveredIndex(@NotNull JList<?> list) {
    Object property = list.getClientProperty(HOVERED_INDEX_KEY);
    return property instanceof Integer ? (Integer)property : -1;
  }
public static int getHoveredIndex(@NotNull JList<?> list)