title: can't get panel added to jtabbed pane after calling setComponentAt()
body: <p>I have added a custom panel named MyEditorPanel which extends JPanel to JTabbedPanel and want a close button on each tab in order to do that i have used following code and used ButtonTabbedComponent.java from <a href="http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TabComponentsDemoProject/src/components/ButtonTabComponent.java" rel="nofollow">ButtonTabbedComponent.java</a></p>
  
  <pre><code>public void addTab(String name, String desc) {
      MyEditorPane textEditorPane = new MyEditorPane(this, name, desc);
      this.addTab(name, normal, textEditorPane, desc);
      int i = this.getComponentCount() - 1;
      textEditorPane.setTabCount(i);
      this.setTabComponentAt(i, new ButtonTabComponent(this, normal, normalFont));
  }
  </code></pre>
  
  <p>but i want to save text in MyEditorPane before closing how can i get which MyEditorPane is being going to close on close button clicked</p>
  
  <p>when i get the name of components in JTabbedPane class it does not have MyEditorPane class object</p>
  
  <pre><code>@Override
  public void remove(int index) {
  
  Component component = this.getTabComponentAt(index);
  if (component instanceof ButtonTabComponent) {
      ButtonTabComponent tab = (ButtonTabComponent) component;
      System.out.println("remove method called if : " + tab.getComponentCount());
      component = tab.getComponent(0);
      System.out.println("remove method called if : " + component.getClass().getName());
  
      component = tab.getComponent(1);
      System.out.println("remove method called if : " + component.getClass().getName());
      JPanel pane = (JPanel) component;
      Component[] components = pane.getComponents();
      for (int i = 0, l = components.length; i &lt; l; i++) {
              System.out.println("remove method called for : " + components[i].getClass().getName());                
      }
      super.remove(index);
  }
  }
  </code></pre>
  
  <p>output of method remove</p>
  
  <pre><code>remove method called if : 2
  remove method called if : javax.swing.JLabel
  remove method called if : javax.swing.JPanel
  remove method called for : pkginterface.ButtonTabComponent$1
  remove method called for : pkginterface.ButtonTabComponent$TabButton
  </code></pre>