code: private void addParentPropertyChangeListener(PropertyChangeListener listener) {
          if (rootParent instanceof JFrame) {
              ((JFrame) rootParent).addPropertyChangeListener(listener);
          } else if (rootParent instanceof JDialog) {
              ((JDialog) rootParent).addPropertyChangeListener(listener);
          }
  
          rootPane.addPropertyChangeListener(listener);
      }
docs: Add a property change listener to the root pane.
  
  @param listener the propertiy change listener to add.