code: private boolean isParentSelected() {
          if (rootParent instanceof JFrame) {
              return ((JFrame) rootParent).isActive();
          } else if (rootParent instanceof JDialog) {
              return ((JDialog) rootParent).isActive();
          } else {
              return true;
          }
      }
docs: Determine if the title pane's parent is active.
  
  @return {@code true} if the parent is active, {@code false} otherwise.