boolean (@NotNull Component component, boolean checkHeadless) { if (checkHeadless && Boolean.getBoolean("java.awt.headless")) { return true; } if (component.isShowing()) { return true; } while (component != null) { JComponent jComponent = component instanceof JComponent ? (JComponent)component : null; if (jComponent != null && Boolean.TRUE.equals(jComponent.getClientProperty(IS_SHOWING))) { return true; } component = component.getParent(); } return false; }