public static void withAllVisibleDo(Container container, ComponentOperation operation) {
    Component[] components = container.getComponents();
    for (Component component : components) {
      if (!component.isVisible()) continue;
      operation.applyTo(component);
    }
  }
public static void withAllVisibleDo(Container container, ComponentOperation operation)