void (@NotNull Component component, boolean enabled, boolean recursively, final boolean visibleOnly) { JBIterable<Component> all = recursively ? uiTraverser(component).expandAndFilter( visibleOnly ? Component::isVisible : Conditions.alwaysTrue()).traverse() : JBIterable.of(component); Color fg = enabled ? getLabelForeground() : getLabelDisabledForeground(); for (Component c : all) { c.setEnabled(enabled); if (c instanceof JLabel) { c.setForeground(fg); } } }