svoid keepComponentsByPred(final Container container, final F1 keep) swing { bool changed = false; if (container != null) for (int i = 0; i < numberOfChildren(container); i++) { Component c = getComponentAtIndex(container, i); if (!callF(keep, c)) { container.remove(c); set changed; --i; } } if (changed) revalidate(container); }