question: protected Size2D drawHorizontal ( Graphics2D g2 , Rectangle2D chartArea ) { double startY ; double topSpace ; double bottomSpace ; double leftSpace ; double rightSpace ; double w = getWidth ( ) ; double h = getHeight ( ) ; RectangleInsets padding = getPadding ( ) ; topSpace = padding . calculateTopOutset ( h ) ; bottomSpace = padding . calculateBottomOutset ( h ) ; leftSpace = padding . calculateLeftOutset ( w ) ; rightSpace = padding . calculateRightOutset ( w ) ; if ( getPosition ( ) == RectangleEdge . TOP ) { startY = chartArea . getY ( ) + topSpace ; } else { startY = chartArea . getY ( ) + chartArea . getHeight ( ) - bottomSpace - h ; } HorizontalAlignment horizontalAlignment = getHorizontalAlignment ( ) ; double startX = 0.0 ; if ( horizontalAlignment == HorizontalAlignment . CENTER ) { startX = chartArea . getX ( ) + leftSpace + chartArea . getWidth ( ) / 2.0 - w / 2.0 ; } else if ( horizontalAlignment == HorizontalAlignment . LEFT ) { startX = chartArea . getX ( ) + leftSpace ; } else if ( horizontalAlignment == HorizontalAlignment . RIGHT ) { startX = chartArea . getX ( ) + chartArea . getWidth ( ) - rightSpace - w ; } g2 . drawImage ( this . image , ( int ) startX , ( int ) startY , ( int ) w , ( int ) h , null ) ; return new Size2D ( chartArea . getWidth ( ) + leftSpace + rightSpace , h + topSpace + bottomSpace ) ; }
target:  Draws the title on a Java 2D graphics device (such as the screen or a printer).