JLayeredPane () { JLayeredPane layeredPane; final Window window = WindowManager.getInstance().suggestParentWindow(myProject); if (window instanceof JFrame) { layeredPane = ((JFrame)window).getLayeredPane(); } else if (window instanceof JDialog) { layeredPane = ((JDialog)window).getLayeredPane(); } else if (window instanceof JWindow) { layeredPane = ((JWindow)window).getLayeredPane(); } else { throw new IllegalStateException("cannot find parent window: project=" + myProject + (myProject != null ? "; open=" + myProject.isOpen() : "") + "; window=" + window); } return layeredPane; }