public DarculaTitlePane(JRootPane root, DarculaRootPaneUI ui) {
    this.myRootPane = root;
    rootPaneUI = ui;

    myState = -1;

    installSubcomponents();
    determineColors();
    installDefaults();

    setLayout(createLayout());
    setBorder(JBUI.Borders.empty(3, 0));
  }
  private static JButton createButton(String accessibleName, Icon icon, Action action) {
    JButton button =
        new JButton() {
          boolean mouseOverButton = false;

          {
            enableEvents(AWTEvent.MOUSE_EVENT_MASK);
            addMouseListener(
                new MouseAdapter() {
                  @Override
                  public void mouseEntered(MouseEvent e) {
                    mouseOverButton = true;
                    repaint();
                  }

                  @Override
                  public void mouseExited(MouseEvent e) {
                    mouseOverButton = false;
                    repaint();
                  }
                });
          }

          @Override
          protected void paintComponent(Graphics g) {
            final Window window = SwingUtilities.windowForComponent(this);
            float alpha = window.isActive() && mouseOverButton ? 1f : 0.5f;
            final GraphicsConfig config = GraphicsUtil.paintWithAlpha(g, alpha);
            getIcon().paintIcon(this, g, 0, 0);
            config.restore();
          }
        };
    button.setFocusPainted(false);
    button.setFocusable(false);
    button.setOpaque(false);
    button.putClientProperty("paintActive", Boolean.TRUE);
    button.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName);
    button.setBorder(JBUI.Borders.empty());
    button.setText(null);
    button.setAction(action);
    button.setIcon(icon);
    return button;
  }