code: private void removeParentPropertyChangeListener(PropertyChangeListener listener) {
          if (rootParent instanceof JFrame) {
              ((JFrame) rootParent).removePropertyChangeListener(listener);
          } else if (rootParent instanceof JDialog) {
              ((JDialog) rootParent).removePropertyChangeListener(listener);
          }
      }
docs: Remove the property change listener from the root pane.
  
  @param listener the property change listener to remove.