JPanel (@NotNull JComponent component) { Container parent = component.getParent(); while (parent != null && !(parent instanceof NewCodeStyleSettingsPanel)) { Container nextParent = parent.getParent(); if (nextParent instanceof JTabbedPane && parent instanceof JPanel) { return (JPanel)parent; } parent = nextParent; } return null; }