int targ = top + position;
int targ = Math.min(top + position, bot-1);
  public void setPosition(Component c, int position)  {    Integer layer = getLayer (c);    int[] range = layerToRange (layer);    if (range[0] == range[1])	    throw new IllegalArgumentException ();    int top = range[0];    int bot = range[1];    if (position == -1)	    position = (bot - top) - 1;    int targ = top + position;    int curr = -1;    Component[] comps = getComponents();    for (int i = top; i < bot; ++i)	    {        if (comps[i] == c)          {            curr = i;            break;          }	    }    if (curr == -1)	    // should have found it	    throw new IllegalArgumentException ();    super.swapComponents (curr, targ);    revalidate();    repaint();  }