void resetToPreferredSizes(int availableSize){
  int[] testSizes=getPreferredSizes();
  int totalSize=0;
  for (int counter=0; counter < 3; counter++) {
    if (testSizes[counter] != -1) {
      totalSize+=testSizes[counter];
    }
  }
  if (totalSize > availableSize) {
    testSizes=getMinimumSizes();
    totalSize=0;
    for (int counter=0; counter < 3; counter++) {
      if (testSizes[counter] != -1) {
        totalSize+=testSizes[counter];
      }
    }
  }
  setSizes(testSizes);
  distributeSpace(availableSize - totalSize,false);
}

void resetToPreferredSizes ( int availableSize ) { int [ ] testSizes = getPreferredSizes ( ) ; int totalSize = 0 ; for ( int counter = 0 ; counter < 3 ; counter ++ ) { if ( testSizes [ counter ] != - 1 ) { totalSize += testSizes [ counter ] ; } } if ( totalSize > availableSize ) { testSizes = getMinimumSizes ( ) ; totalSize = 0 ; for ( int counter = 0 ; counter < 3 ; counter ++ ) { if ( testSizes [ counter ] != - 1 ) { totalSize += testSizes [ counter ] ; } } } setSizes ( testSizes ) ; distributeSpace ( availableSize - totalSize , false ) ; }
resets the components to their preferred sizes .
