question: public static void center ( Component componentToMove , Component componentToCenterOn ) { Dimension componentToCenterOnSize = componentToCenterOn . getSize ( ) ; componentToMove . setLocation ( componentToCenterOn . getX ( ) + ( ( componentToCenterOnSize . width - componentToMove . getWidth ( ) ) / 2 ) , componentToCenterOn . getY ( ) + ( ( componentToCenterOnSize . height - componentToMove . getHeight ( ) ) / 2 ) ) ; }
target:  Centers the first component on the second