/**
   * Creates a new tab overview button.
   *
   * @param tabPane The owner tabbed pane.
   */
  public TabOverviewButton(final JTabbedPane tabPane) {
    this.setFocusable(false);
    LafWidgetSupport support = LafWidgetRepository.getRepository().getLafSupport();

    if (support != null) {
      Icon searchIcon =
          support.getSearchIcon(
              LafWidgetRepository.getRepository().getLafSupport().getLookupIconSize(),
              tabPane.getComponentOrientation());
      this.setIcon(searchIcon);
      support.markButtonAsFlat(this);
    }
    this.setToolTipText(
        LafWidgetUtilities.getResourceBundle(tabPane)
            .getString("TabbedPane.overviewButtonTooltip"));

    this.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            TabOverviewDialog.getOverviewDialog(tabPane).setVisible(true);
          }
        });
  }
  /**
   * Updates the location of <code>this</code> tab overview button.
   *
   * @param tabbedPane Tabbed pane.
   * @param tabAreaInsets Tab area insets.
   */
  public void updateLocation(JTabbedPane tabbedPane, Insets tabAreaInsets) {
    if (tabbedPane == null) return;

    // Lock the button for the bounds change
    this.putClientProperty(TabOverviewButton.OWN_BOUNDS, Boolean.TRUE);
    int buttonSize = LafWidgetRepository.getRepository().getLafSupport().getLookupButtonSize();

    switch (tabbedPane.getTabPlacement()) {
      case SwingConstants.TOP:
        if (tabbedPane.getComponentOrientation().isLeftToRight())
          this.setBounds(2, tabAreaInsets.top, buttonSize, buttonSize);
        else
          this.setBounds(
              tabbedPane.getBounds().width - tabAreaInsets.right - buttonSize - 2,
              tabAreaInsets.top,
              buttonSize,
              buttonSize);
        break;
      case SwingConstants.BOTTOM:
        if (tabbedPane.getComponentOrientation().isLeftToRight())
          this.setBounds(
              2,
              tabbedPane.getBounds().height - tabAreaInsets.bottom - buttonSize - 4,
              buttonSize,
              buttonSize);
        else
          this.setBounds(
              tabbedPane.getBounds().width - tabAreaInsets.right - buttonSize - 2,
              tabbedPane.getBounds().height - tabAreaInsets.bottom - buttonSize - 4,
              buttonSize,
              buttonSize);
        break;
      case SwingConstants.LEFT:
        this.setBounds(2, tabAreaInsets.top - 1, buttonSize, buttonSize);
        break;
      case SwingConstants.RIGHT:
        this.setBounds(
            tabbedPane.getBounds().width - tabAreaInsets.right - buttonSize - 2,
            tabAreaInsets.top - 1,
            buttonSize,
            buttonSize);
        break;
    }
    // Unlock the button for the bounds change
    this.putClientProperty(TabOverviewButton.OWN_BOUNDS, null);
  }