Last active
March 10, 2019 12:23
-
-
Save ezhov-da/c0f2639e54e63477c8f13a99e1ccb2fa to your computer and use it in GitHub Desktop.
java componentenable отключение и включение всех компонентов в родителе
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Component; | |
import java.awt.Container; | |
import java.util.logging.Logger; | |
/** | |
* Класс отключает и включает все компоненты в контейнере | |
* <p> | |
* @author ezhov_da | |
*/ | |
public class ComponentEnable | |
{ | |
private static final Logger LOG = Logger.getLogger(ComponentEnable.class.getName()); | |
public static void setRecursiveEnable(Container container, boolean enabled) | |
{ | |
for (Component component : container.getComponents()) | |
{ | |
if (component instanceof Container) | |
{ | |
setRecursiveEnable((Container) component, enabled); | |
} | |
component.setEnabled(enabled); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment