@Override
  protected void paintComponent(final Graphics g) {
    if (!enableClose) {
      super.paintComponent(g);
      return;
    }

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

    final int w = getWidth();
    final int h = getHeight();
    final int delta = 4;

    Color crossColor = CROSS_COLOR;
    if (getModel().isRollover()) {
      g2.setColor(!getModel().isPressed() ? CROSS_BACKGROUND_ROLLOVER : CROSS_BACKGROUND_PRESSED);
      g2.fillArc(0, 0, w, h, 0, 360);
      crossColor = CROSS_COLOR_ROLLOVER;
    }
    g2.setColor(crossColor);
    g2.setStroke(new BasicStroke(1.5f));
    g2.drawLine(delta - 1, delta - 1, w - delta, h - delta);
    g2.drawLine(delta - 1, h - delta, w - delta, delta - 1);
    g2.dispose();
  }
A tab button similar in style to the one used in Google Chrome.
java/ui/src/main/java/com/google/security/zynamics/bindiff/gui/components/closeablebuttontab/TabButton.java