protected void paintTab(
      final Graphics g,
      final Rectangle[] rects,
      final int tabIndex,
      final Rectangle iconRect,
      final Rectangle textRect) {
    Rectangle tabRect = rects[tabIndex];
    int selectedIndex = tabPane.getSelectedIndex();
    boolean isSelected = selectedIndex == tabIndex;

    final Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHints(
        new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));

    final GeneralPath path = new GeneralPath();
    path.moveTo(tabRect.x, tabRect.y + tabRect.height); // Bottom left
    path.curveTo(
        tabRect.x,
        tabRect.y + tabRect.height,
        tabRect.x + 8,
        tabRect.y + tabRect.height,
        tabRect.x + 8,
        tabRect.y + tabRect.height - 8);
    path.lineTo(tabRect.x + 8, tabRect.y + 8); // Left line
    path.curveTo(
        tabRect.x + 8,
        tabRect.y + 8,
        tabRect.x + 8,
        tabRect.y,
        tabRect.x + 16,
        tabRect.y); // Top left
    path.lineTo(tabRect.x + tabRect.width - 16, tabRect.y); // Top line
    path.curveTo(
        tabRect.x + tabRect.width - 16,
        tabRect.y,
        tabRect.x + tabRect.width - 8,
        tabRect.y,
        tabRect.x + tabRect.width - 8,
        tabRect.y + 8); // Top right
    path.lineTo(tabRect.x + tabRect.width - 8, tabRect.y + tabRect.height - 8); // Right line
    path.curveTo(
        tabRect.x + tabRect.width - 8,
        tabRect.y + tabRect.height - 8,
        tabRect.x + tabRect.width - 8,
        tabRect.y + tabRect.height,
        tabRect.x + tabRect.width,
        tabRect.y + tabRect.height); // Bottom right
    path.closePath(); // Bottom line

    Color tabColor = tabPane.getBackgroundAt(tabIndex);
    if (!isSelected) {
      tabColor = darker(tabColor);
    }
    g2d.setColor(tabColor);
    g2d.fill(path);

    g2d.setColor(darkShadow);
    if (isSelected) {
      g2d.draw(path);
    } else if (tabIndex > 0) {
      g2d.drawLine(
          tabRect.x + 8, tabRect.y + 8, tabRect.x + 8, tabRect.y + tabRect.height - 8); // Left line
    }

    final String title = tabPane.getTitleAt(tabIndex);
    final Font font = tabPane.getFont();
    final FontMetrics metrics = g.getFontMetrics(font);
    final Icon icon = getIconForTab(tabIndex);

    if (tabPane.getTabComponentAt(tabIndex) == null) {
      layoutLabel(TOP, metrics, tabIndex, title, icon, tabRect, iconRect, textRect, isSelected);
      final String clippedTitle =
          BasicGraphicsUtils.getClippedString(null, metrics, title, textRect.width);
      paintText(g, TOP, font, metrics, tabIndex, clippedTitle, textRect, isSelected);
      paintIcon(g, TOP, tabIndex, icon, iconRect, isSelected);
    }
  }
Paints a single tab.

@param g the graphics object to use for rendering
@param rects an array with pre-calculated tab metrics
@param tabIndex the index of the tab to paint
@param iconRect the bounds for an optional icon
@param textRect the bounds for the tab label, if applicable
java/ui/src/main/java/com/google/security/zynamics/bindiff/gui/components/MaterialChromeTabbedPaneUI.java