void (Component container, Consumer<? super Component> consumer, JComponent... excludeComponents) { if (excludeComponents != null && ArrayUtil.find(excludeComponents, container) != -1) return; consumer.consume(container); if (container instanceof Container) { final Component[] components = ((Container)container).getComponents(); for (Component child : components) { iterateChildren(child, consumer, excludeComponents); } } }