code: public static Iterator<Component> iterator(final JTabbedPane self) {
          return new Iterator<Component>() {
              private int index = 0;
  
              public boolean hasNext() {
                  return index > -1 && index < self.getTabCount();
              }
  
              public Component next() {
                  return self.getComponentAt(index++);
              }
  
              public void remove() {
                  if (hasNext()) self.removeTabAt(index--);
              }
          };
      }
docs: Returns an {@link java.util.Iterator} which traverses the JTabbedPane one Component tab at a time.
  
  @param self a JTabbedPane
  @return an Iterator for a JTabbedPane
  @since 1.6.4