private static Component searchShowing(@NotNull List<? extends Component> components, int start, int direction) {
    for (int i = start; i >= 0 && i < components.size(); i += direction) {
      Component c = components.get(i);
      if (c != null && c.isShowing()) return c;
    }
    return null;
  }
private static Component searchShowing(@NotNull List<? extends Component> components, int start, int direction)