Java tutorial
//package com.java2s; //License from project: Mozilla Public License import java.awt.Component; import java.awt.Container; public class Main { public static void setVisible(Component container, boolean visible) { if (container instanceof Container) { for (Component component : ((Container) container).getComponents()) { component.setVisible(visible); if (component instanceof Container) { setVisible(component, visible); } } } container.setVisible(visible); } }