public void addClosableTab(String name, String tooltip, Icon icon, JComponent component, boolean show) {
    JTabbedPane tabbedPane = getJTabbedPane();
    if (tabbedPane.indexOfComponent(component) == -1) {
      int tabCount = tabbedPane.getTabCount();
      tabbedPane.addTab(name, icon, component);
      tabbedPane.setTabComponentAt(tabCount, new TabHeader(tabbedPane, name, icon, tooltip));
      tabbedPane.setSelectedIndex(tabCount);
    }
    if (show) {
      tabbedPane.setSelectedComponent(component);
    }
  }
Created by IntelliJ IDEA.
User: Krzysztof Otrebski
Date: 3/29/12
Time: 6:57 AM
olv-core/src/main/java/pl/otros/logview/api/OtrosApplication.java