private void layoutChild ( Component component , int cellX , int cellY , int cellSizeX , int cellSizeY ) { int maxAspectW = ( int ) ( cellSizeY * aspect ) ; int maxAspectH = ( int ) ( cellSizeX / aspect ) ; if ( maxAspectW > cellSizeX ) { int w = cellSizeX ; int h = maxAspectH ; int space = cellSizeY - h ; int offset = ( int ) ( alignment * space ) ; component . setBounds ( cellX , cellY + offset , w , h ) ; } else { int w = maxAspectW ; int h = cellSizeY ; int space = cellSizeX - w ; int offset = ( int ) ( alignment * space ) ; component . setBounds ( cellX + offset , cellY , w , h ) ; } }
Lay out the given child component inside its parent obeying the aspect ratio and alignment constraints of this layout .