void () { if (myPanel != null) { return; } myPanel = new JPanel(new BorderLayout()); ComponentUtil .putClientProperty(myPanel, UIUtil.NOT_IN_HIERARCHY_COMPONENTS, (Iterable<? extends Component>)(Iterable<JComponent>)() -> { if (myContentManager == null || myContentManager.getContentCount() == 0) { return Collections.emptyIterator(); } return JBIterable.of(myContentManager.getContents()) .map(content -> { JComponent component = content.getComponent(); return myPanel != component.getParent() ? component : null; }) .filter(Conditions.notNull()) .iterator(); }); }