Insets tabAreaInsets = getTabAreaInsets(tabPlacement);
    protected void normalizeTabRuns(int tabPlacement, int tabCount, int start,                                    int max)    {      Insets tabAreaInsets = getTabAreaInsets(tabPlacement);      if (tabPlacement == SwingUtilities.TOP          || tabPlacement == SwingUtilities.BOTTOM)        {          // We should only do this for runCount - 1, cause we can only shift that many times between          // runs.          for (int i = 1; i < runCount; i++)            {              Rectangle currRun = rects[lastTabInRun(tabCount, i)];              Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];              int spaceInCurr = currRun.x + currRun.width;              int spaceInNext = nextRun.x + nextRun.width;              int diffNow = spaceInCurr - spaceInNext;              int diffLater = (spaceInCurr - currRun.width)              - (spaceInNext + currRun.width);              while (Math.abs(diffLater) < Math.abs(diffNow)                  && spaceInNext + currRun.width < max)                {                  tabRuns[i]--;                  spaceInNext += currRun.width;                  spaceInCurr -= currRun.width;                  currRun = rects[lastTabInRun(tabCount, i)];                  diffNow = spaceInCurr - spaceInNext;                  diffLater = (spaceInCurr - currRun.width)                  - (spaceInNext + currRun.width);                }              // Fix the bounds.              int first = lastTabInRun(tabCount, i) + 1;              int last = lastTabInRun(tabCount, getNextTabRun(i));              int currX = tabAreaInsets.left;              for (int j = first; j <= last; j++)                {                  rects[j].x = currX;                  currX += rects[j].width;                }            }        }      else        {          for (int i = 1; i < runCount; i++)            {              Rectangle currRun = rects[lastTabInRun(tabCount, i)];              Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];              int spaceInCurr = currRun.y + currRun.height;              int spaceInNext = nextRun.y + nextRun.height;              int diffNow = spaceInCurr - spaceInNext;              int diffLater = (spaceInCurr - currRun.height)              - (spaceInNext + currRun.height);              while (Math.abs(diffLater) < Math.abs(diffNow)                  && spaceInNext + currRun.height < max)                {                  tabRuns[i]--;                  spaceInNext += currRun.height;                  spaceInCurr -= currRun.height;                  currRun = rects[lastTabInRun(tabCount, i)];                  diffNow = spaceInCurr - spaceInNext;                  diffLater = (spaceInCurr - currRun.height)                  - (spaceInNext + currRun.height);                }              int first = lastTabInRun(tabCount, i) + 1;              int last = lastTabInRun(tabCount, getNextTabRun(i));              int currY = tabAreaInsets.top;              for (int j = first; j <= last; j++)                {                  rects[j].y = currY;                  currY += rects[j].height;                }            }        }    }