private static int origin ( Alignment alignment , int cellOrigin , int cellSize , int componentSize ) { if ( alignment == RIGHT || alignment == BOTTOM ) { return cellOrigin + cellSize - componentSize ; } else if ( alignment == CENTER ) { return cellOrigin + ( cellSize - componentSize ) / 2 ; } else { // left, top, fill return cellOrigin ; } }
Computes and returns the component s pixel origin .