code: public static void addTo(
          JTabbedPane tabbedPane, String title, JComponent component, 
          CloseCallback closeCallback)
      {
          int index = tabbedPane.getTabCount();
          tabbedPane.addTab(title, component);
          tabbedPane.setTabComponentAt(
              index, new CloseableTab(tabbedPane, closeCallback));
          tabbedPane.setSelectedIndex(index);
      }
docs: Adds a {@link CloseableTab} with the given title and component to
  the given tabbed pane. The given {@link CloseCallback} will be
  consulted to decide whether the tab may be closed
  
  @param tabbedPane The tabbed pane
  @param title The title of the tab
  @param component The component in the tab
  @param closeCallback The {@link CloseCallback}