/**
   * Installs the necessary state onto the JRootPane to render client decorations. This is ONLY
   * invoked if the <code>JRootPane</code> has a decoration style other than <code>JRootPane.NONE
   * </code>.
   */
  private void installClientDecorations(JRootPane root) {
    installBorder(root);

    JComponent titlePane = createTitlePane(root);

    setTitlePane(root, titlePane);
    installWindowListeners(root, root.getParent());
    installLayout(root);
    if (window != null) {
      root.revalidate();
      root.repaint();
    }
  }
 /**
  * Uninstalls any state that <code>installClientDecorations</code> has installed.
  *
  * <p>NOTE: This may be called if you haven't installed client decorations yet (ie before <code>
  * installClientDecorations</code> has been invoked).
  */
 private void uninstallClientDecorations(JRootPane root) {
   uninstallBorder(root);
   uninstallWindowListeners(root);
   setTitlePane(root, null);
   uninstallLayout(root);
   // We have to revalidate/repaint root if the style is JRootPane.NONE
   // only. When we needs to call revalidate/repaint with other styles
   // the installClientDecorations is always called after this method
   // imediatly and it will cause the revalidate/repaint at the proper
   // time.
   int style = root.getWindowDecorationStyle();
   if (style == JRootPane.NONE) {
     root.repaint();
     root.revalidate();
   }
   // Reset the cursor, as we may have changed it to a resize cursor
   if (window != null) {
     window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   }
   window = null;
 }