@Override
  protected void installListeners() {
    super.installListeners();

    panePropertyListener = evt -> {
      String propName = evt.getPropertyName();
      if ("JTabbedPane.hasFullBorder".equals(propName) || "tabLayoutPolicy".equals(propName)) {
        boolean fullBorder = tabPane.getClientProperty("JTabbedPane.hasFullBorder") == Boolean.TRUE;
        contentBorderInsets = (tabPane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT) ?
                              fullBorder ? JBUI.insets(1) : JBUI.insetsTop(1) :
                              fullBorder ? JBUI.insets(0, 1, 1, 1) : JBInsets.emptyInsets();
        tabPane.revalidate();
        tabPane.repaint();
      }
      else if ("enabled".equals(propName)) {
        for (int ti = 0; ti < tabPane.getTabCount(); ti++) {
          Component tc = tabPane.getTabComponentAt(ti);
          if (tc != null) {
            tc.setEnabled(evt.getNewValue() == Boolean.TRUE);
          }
        }
        tabPane.repaint();
      }
      else if ("tabPlacement".equals(propName)) {
        int index = tabPane.getSelectedIndex();
        tabPane.setSelectedIndex(-1);
        SwingUtilities.invokeLater(() -> {
          tabPane.setSelectedIndex(index);
        });
      }
    };

    tabPane.addPropertyChangeListener(panePropertyListener);

    paneComponentListener = new ComponentAdapter() {
      @Override
      public void componentResized(ComponentEvent e) {
        ensureSelectedTabIsVisible();
      }
    };
    tabPane.addComponentListener(paneComponentListener);

    paneChangeListener = e -> ensureSelectedTabIsVisible();

    tabPane.addChangeListener(paneChangeListener);

    paneMouseListener = new MouseAdapter() {
      @Override
      public void mouseEntered(MouseEvent e) {
        hoverTab = tabForCoordinate(tabPane, e.getX(), e.getY());
        tabPane.repaint();
      }

      @Override
      public void mouseExited(MouseEvent e) {
        hoverTab = -1;
        tabPane.repaint();
      }
    };

    tabPane.addMouseListener(paneMouseListener);

    paneMouseMotionListener = new MouseMotionAdapter() {
      @Override
      public void mouseMoved(MouseEvent e) {
        hoverTab = tabForCoordinate(tabPane, e.getX(), e.getY());
        tabPane.repaint();
      }
    };
    tabPane.addMouseMotionListener(paneMouseMotionListener);
  }
@Override
  protected void installListeners()