question: protected void center ( ) { Container parent = getParent ( ) ; final Dimension size = getPreferredSize ( ) ; setBounds ( ( parent . getWidth ( ) - size . width ) / 2 , ( parent . getHeight ( ) - size . height ) / 2 , size . width , size . height ) ; }
target:  Center the window within the parent component.