protected Size2D arrangeFN(BlockContainer container,Graphics2D g2,RectangleConstraint constraint){
  List blocks=container.getBlocks();
  double width=constraint.getWidth();
  double x=0.0;
  double y=0.0;
  double maxHeight=0.0;
  List itemsInRow=new ArrayList();
  for (int i=0; i < blocks.size(); i++) {
    Block block=(Block)blocks.get(i);
    Size2D size=block.arrange(g2,RectangleConstraint.NONE);
    if (x + size.width <= width) {
      itemsInRow.add(block);
      block.setBounds(new Rectangle2D.Double(x,y,size.width,size.height));
      x=x + size.width + this.horizontalGap;
      maxHeight=Math.max(maxHeight,size.height);
    }
 else {
      if (itemsInRow.isEmpty()) {
        block.setBounds(new Rectangle2D.Double(x,y,Math.min(size.width,width - x),size.height));
        x=0.0;
        y=y + size.height + this.verticalGap;
      }
 else {
        itemsInRow.clear();
        x=0.0;
        y=y + maxHeight + this.verticalGap;
        maxHeight=size.height;
        block.setBounds(new Rectangle2D.Double(x,y,Math.min(size.width,width),size.height));
        x=size.width + this.horizontalGap;
        itemsInRow.add(block);
      }
    }
  }
  return new Size2D(constraint.getWidth(),y + maxHeight);
}

protected Size2D arrangeFN ( BlockContainer container , Graphics2D g2 , RectangleConstraint constraint ) { List blocks = container . getBlocks ( ) ; double width = constraint . getWidth ( ) ; double x = 0.0 ; double y = 0.0 ; double maxHeight = 0.0 ; List itemsInRow = new ArrayList ( ) ; for ( int i = 0 ; i < blocks . size ( ) ; i ++ ) { Block block = ( Block ) blocks . get ( i ) ; Size2D size = block . arrange ( g2 , RectangleConstraint . NONE ) ; if ( x + size . width <= width ) { itemsInRow . add ( block ) ; block . setBounds ( new Rectangle2D . Double ( x , y , size . width , size . height ) ) ; x = x + size . width + this . horizontalGap ; maxHeight = Math . max ( maxHeight , size . height ) ; } else { if ( itemsInRow . isEmpty ( ) ) { block . setBounds ( new Rectangle2D . Double ( x , y , Math . min ( size . width , width - x ) , size . height ) ) ; x = 0.0 ; y = y + size . height + this . verticalGap ; } else { itemsInRow . clear ( ) ; x = 0.0 ; y = y + maxHeight + this . verticalGap ; maxHeight = size . height ; block . setBounds ( new Rectangle2D . Double ( x , y , Math . min ( size . width , width ) , size . height ) ) ; x = size . width + this . horizontalGap ; itemsInRow . add ( block ) ; } } } return new Size2D ( constraint . getWidth ( ) , y + maxHeight ) ; }
arranges the blocks in the container with a fixed width and no height constraint .
