private void determineColumnWidths(){
  int minWidth=indentWidth;
  int expandableColumnSize=0;
  for (int i=0; i < totalColumns; i++) {
    int actualSize=columnWidths.get(i);
    if (fixedColumns.containsKey(i)) {
      int requestedSize=fixedColumns.get(i);
      if (requestedSize == 0) {
        expandableColumnSize+=actualSize;
      }
 else {
        columnWidths.set(i,requestedSize);
        minWidth+=requestedSize;
      }
    }
 else {
      minWidth+=actualSize;
    }
    if (i > 0) {
      minWidth+=padding * 2 + columnSeparator.length();
    }
  }
  if (minWidth > totalWidth) {
  }
 else {
    int available=totalWidth - minWidth;
    if (expandableColumnSize > available) {
      for (int i=0; i < totalColumns; i++) {
        int actualSize=columnWidths.get(i);
        if (fixedColumns.containsKey(i)) {
          int requestedSize=fixedColumns.get(i);
          if (requestedSize == 0) {
            requestedSize=(actualSize * available) / expandableColumnSize;
            columnWidths.set(i,requestedSize);
          }
        }
      }
    }
  }
}

private void determineColumnWidths ( ) { int minWidth = indentWidth ; int expandableColumnSize = 0 ; for ( int i = 0 ; i < totalColumns ; i ++ ) { int actualSize = columnWidths . get ( i ) ; if ( fixedColumns . containsKey ( i ) ) { int requestedSize = fixedColumns . get ( i ) ; if ( requestedSize == 0 ) { expandableColumnSize += actualSize ; } else { columnWidths . set ( i , requestedSize ) ; minWidth += requestedSize ; } } else { minWidth += actualSize ; } if ( i > 0 ) { minWidth += padding * 2 + columnSeparator . length ( ) ; } } if ( minWidth > totalWidth ) { } else { int available = totalWidth - minWidth ; if ( expandableColumnSize > available ) { for ( int i = 0 ; i < totalColumns ; i ++ ) { int actualSize = columnWidths . get ( i ) ; if ( fixedColumns . containsKey ( i ) ) { int requestedSize = fixedColumns . get ( i ) ; if ( requestedSize == 0 ) { requestedSize = ( actualSize * available ) / expandableColumnSize ; columnWidths . set ( i , requestedSize ) ; } } } } } }
we need to calculate the effective width of each column .
