void (Component visible) { if (visible != null && !visible.isVisible()) { Container container = visible.getParent(); if (container != null) { synchronized (container.getTreeLock()) { for (Component component : container.getComponents()) { component.setVisible(component == visible); } } } } }