int currRun = 1;  if (tabCount < 1) return;  if (runCount > 1) currRun = 0; for (int i = 0; i < runCount; i++) { int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1; if (isScroll) first = currentScrollLocation; else if (first == tabCount) first = 0; int last = lastTabInRun(tabCount, currRun); if (isScroll)
for (int i = runCount - 1; i >= 0; --i)
  protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex)  {    Rectangle ir = new Rectangle();    Rectangle tr = new Rectangle();    boolean isScroll = tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT;    // Please note: the ordering of the painting is important.     // we WANT to paint the outermost run first and then work our way in.    int tabCount = tabPane.getTabCount();    int currRun = 1;        if (tabCount < 1)      return;    if (runCount > 1)      currRun = 0;    for (int i = 0; i < runCount; i++)      {        int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;        if (isScroll)          first = currentScrollLocation;        else if (first == tabCount)          first = 0;        int last = lastTabInRun(tabCount, currRun);        if (isScroll)          {            for (int k = first; k < tabCount; k++)              {                if (rects[k].x + rects[k].width - rects[first].x > viewport                    .getWidth())                  {                    last = k;                    break;                  }              }          }        for (int j = first; j <= last; j++)          {            if (j != selectedIndex || isScroll)              paintTab(g, tabPlacement, rects, j, ir, tr);          }        currRun = getPreviousTabRun(currRun);      }    if (! isScroll)      paintTab(g, tabPlacement, rects, selectedIndex, ir, tr);  }