private static void addTabOrientationMenuItems(JPopupMenu menu, DockingWindow window) {
    final AbstractTabWindow tabWindow = getTabWindowFor(window);

    if (tabWindow == null || tabWindow instanceof WindowBar) return;

    JMenu orientationMenu = new JMenu("Tab Orientation");
    TabbedPanelProperties properties =
        tabWindow.getTabWindowProperties().getTabbedPanelProperties();
    final Direction[] directions = Direction.getDirections();

    for (int i = 0; i < directions.length; i++) {
      final Direction dir = directions[i];
      JMenuItem item = orientationMenu.add(new JMenuItem(dir.getName(), ARROW_ICONS[i]));
      item.setEnabled(dir != properties.getTabAreaOrientation());
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              tabWindow
                  .getTabWindowProperties()
                  .getTabbedPanelProperties()
                  .setTabAreaOrientation(dir);
            }
          });
    }

    menu.add(orientationMenu);
  }
  /**
   * Creates the hover menu
   *
   * @return the thover menu
   */
  private JMenu createHoverMenu() {
    // Creating a solid background painter with a blusih color. Using a
    // component painter instead of just background color so that it works
    // for themes that has component painter. NOTE that it still might not
    // work for all themes such as the GradientTheme!
    ComponentPainter backgroundPainter =
        new SolidColorComponentPainter(new FixedColorProvider(new Color(128, 128, 255)));

    // Creating hover properties object for tab
    TitledTabProperties titledTabHoverProperties = new TitledTabProperties();
    // Setting the background painter for the highlighted state
    titledTabHoverProperties
        .getHighlightedProperties()
        .getShapedPanelProperties()
        .setComponentPainter(backgroundPainter);

    // Creating hover properties object for tabbed panel
    TabbedPanelProperties tabbedPanelHoverProperties = new TabbedPanelProperties();
    // Setting the background painter for the content area
    tabbedPanelHoverProperties
        .getContentPanelProperties()
        .getShapedPanelProperties()
        .setComponentPainter(backgroundPainter);

    // Creating a hover action for the tabbed panel that uses both the
    // hover properties for the tabbed panel and the tab. The titledTabHoverProperties
    // will be used for all the tabs when the tabbed panel is hovered (in our case the
    // content area, see further down).
    final TabbedPanelTitledTabHoverAction tabbedPanelTitledTabHoverAction =
        new TabbedPanelTitledTabHoverAction(tabbedPanelHoverProperties, titledTabHoverProperties);
    // Creating a hover action for the tab that uses both the hover
    // properties for the tab and the tabbed panel. The tabbedPanelHoverProperties
    // will be used for the tabbed panel when the tab is hovered.
    final TitledTabTabbedPanelHoverAction titledTabTabbedPanelAction =
        new TitledTabTabbedPanelHoverAction(titledTabHoverProperties, tabbedPanelHoverProperties);

    JMenu hoverMenu = new JMenu("Hover");

    hoverMenu.add(
        createMenuItem(
            "Activate Hover Effect",
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                if (hoverEffectActive) {
                  // Removing the hover actions
                  tabbedPanel
                      .getProperties()
                      .getContentPanelProperties()
                      .getMap()
                      .removeValue(TabbedPanelContentPanelProperties.HOVER_LISTENER);
                  titledTabProperties.getMap().removeValue(TitledTabProperties.HOVER_LISTENER);

                  hoverEffectActive = false;
                  ((JMenuItem) e.getSource()).setText("Activate Hover Effect");
                } else {
                  // Check to see if hover is enabled
                  if (TabbedUtils.isHoverEnabled()) {
                    // Setting the hover actions as hover listener. Note that the
                    // action is set for the content area and not for the entire
                    // tabbed panel because we only want hovering for the content
                    // area (and the tabs).
                    tabbedPanel
                        .getProperties()
                        .getContentPanelProperties()
                        .setHoverListener(tabbedPanelTitledTabHoverAction);
                    // Setting the hover actions as hover listener for the tab.
                    titledTabProperties.setHoverListener(titledTabTabbedPanelAction);

                    hoverEffectActive = true;
                    ((JMenuItem) e.getSource()).setText("Deactivate Hover Effect");
                  } else {
                    // Hover is not enabled, most likely because the example was run using web
                    // start.
                    showHoverDisabledDialog();
                  }
                }
              }
            }));

    return hoverMenu;
  }