IdeGlassPane (@NotNull Component component) { if (!(component instanceof JComponent)) { throw new IllegalArgumentException("Component must be instance of JComponent"); } JRootPane root = ((JComponent)component).getRootPane(); if (root == null) { throw new IllegalArgumentException("Component must be visible in order to find glass pane for it"); } Component gp = root.getGlassPane(); if (!(gp instanceof IdeGlassPane)) { throw new IllegalArgumentException("Glass pane should be " + IdeGlassPane.class.getName()); } return (IdeGlassPane)gp; }