@Override
    public void actionPerformed(final ActionEvent event) {
      final int i = pane.indexOfTabComponent(tabButtonComponent);
      if (i == -1) {
        return;
      }

      for (final ICloseTabButtonListener listener : closeTabButtonListeners) {
        try {
          if (!listener.closing(tabButtonComponent)) {
            return;
          }
        } catch (final Exception e) {
          logger.atSevere().withCause(e).log("An error occurred while closing the tab");
          MessageBox.showError(
              SwingUtilities.getWindowAncestor(TabButton.this),
              "An error occurred while closing the tab.");
        }
      }
    }
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