public void layout(){
  int vis, maximum;
  boolean vsbWasVisible;
  int origVSBVal;
  assert (target != null);
  origVSBVal=vsb.getValue();
  vis=itemsInWindow(false);
  maximum=items.size() < vis ? vis : items.size();
  vsb.setValues(vsb.getValue(),vis,vsb.getMinimum(),maximum);
  vsbVis=vsbWasVisible=vsbIsVisible(false);
  listHeight=height;
  listWidth=getListWidth();
  vis=listWidth - ((2 * SPACE) + (2 * MARGIN));
  maximum=maxLength < vis ? vis : maxLength;
  hsb.setValues(hsb.getValue(),vis,hsb.getMinimum(),maximum);
  hsbVis=hsbIsVisible(vsbVis);
  if (hsbVis) {
    listHeight=height - SCROLLBAR_AREA;
    vis=itemsInWindow(true);
    maximum=items.size() < vis ? vis : items.size();
    vsb.setValues(origVSBVal,vis,vsb.getMinimum(),maximum);
    vsbVis=vsbIsVisible(true);
  }
  if (vsbWasVisible != vsbVis) {
    listWidth=getListWidth();
    vis=listWidth - ((2 * SPACE) + (2 * MARGIN));
    maximum=maxLength < vis ? 0 : maxLength;
    hsb.setValues(hsb.getValue(),vis,hsb.getMinimum(),maximum);
    hsbVis=hsbIsVisible(vsbVis);
  }
  vsb.setSize(SCROLLBAR_WIDTH,listHeight);
  hsb.setSize(listWidth,SCROLLBAR_WIDTH);
  vsb.setBlockIncrement(itemsInWindow());
  hsb.setBlockIncrement(width - ((2 * SPACE) + (2 * MARGIN) + (vsbVis ? SCROLLBAR_AREA : 0)));
}

public void layout ( ) { int vis , maximum ; boolean vsbWasVisible ; int origVSBVal ; assert ( target != null ) ; origVSBVal = vsb . getValue ( ) ; vis = itemsInWindow ( false ) ; maximum = items . size ( ) < vis ? vis : items . size ( ) ; vsb . setValues ( vsb . getValue ( ) , vis , vsb . getMinimum ( ) , maximum ) ; vsbVis = vsbWasVisible = vsbIsVisible ( false ) ; listHeight = height ; listWidth = getListWidth ( ) ; vis = listWidth - ( ( 2 * SPACE ) + ( 2 * MARGIN ) ) ; maximum = maxLength < vis ? vis : maxLength ; hsb . setValues ( hsb . getValue ( ) , vis , hsb . getMinimum ( ) , maximum ) ; hsbVis = hsbIsVisible ( vsbVis ) ; if ( hsbVis ) { listHeight = height - SCROLLBAR_AREA ; vis = itemsInWindow ( true ) ; maximum = items . size ( ) < vis ? vis : items . size ( ) ; vsb . setValues ( origVSBVal , vis , vsb . getMinimum ( ) , maximum ) ; vsbVis = vsbIsVisible ( true ) ; } if ( vsbWasVisible != vsbVis ) { listWidth = getListWidth ( ) ; vis = listWidth - ( ( 2 * SPACE ) + ( 2 * MARGIN ) ) ; maximum = maxLength < vis ? 0 : maxLength ; hsb . setValues ( hsb . getValue ( ) , vis , hsb . getMinimum ( ) , maximum ) ; hsbVis = hsbIsVisible ( vsbVis ) ; } vsb . setSize ( SCROLLBAR_WIDTH , listHeight ) ; hsb . setSize ( listWidth , SCROLLBAR_WIDTH ) ; vsb . setBlockIncrement ( itemsInWindow ( ) ) ; hsb . setBlockIncrement ( width - ( ( 2 * SPACE ) + ( 2 * MARGIN ) + ( vsbVis ? SCROLLBAR_AREA : 0 ) ) ) ; }
layout the sub - components of the list - that is , the scrollbars and the list of items .
