void (Component parentComponent) { if (shouldBeIgnored(parentComponent)) { return; } if (parentComponent instanceof Container container && processChildren((Container)parentComponent)) { for (int i = 0; i < container.getComponentCount(); i++) { register(container.getComponent(i)); } container.addContainerListener(myContainerListener); } processComponent(parentComponent); }