question: public void paintComponent ( Graphics g ) { int x = PADDING ; int y = PADDING ; g . drawImage ( picture , x , y , scaleW , scaleH , null ) ; x += scaleW + PADDING ; g . drawImage ( picture , x , y , x + scaleW , y + scaleH , 0 , 0 , picture . getWidth ( ) , picture . getHeight ( ) , null ) ; x += scaleW + PADDING ; Graphics2D g2d = ( Graphics2D ) g . create ( ) ; g2d . translate ( x , y ) ; g2d . scale ( SCALE_FACTOR , SCALE_FACTOR ) ; g2d . drawImage ( picture , 0 , 0 , null ) ; g2d . dispose ( ) ; x += scaleW + PADDING ; g2d = ( Graphics2D ) g . create ( ) ; AffineTransform at = new AffineTransform ( ) ; at . translate ( x , y ) ; at . scale ( SCALE_FACTOR , SCALE_FACTOR ) ; g2d . drawImage ( picture , at , null ) ; g2d . dispose ( ) ; x += scaleW + PADDING ; Image scaledImg = picture . getScaledInstance ( scaleW , scaleH , Image . SCALE_DEFAULT ) ; g . drawImage ( scaledImg , x , y , null ) ; }
target:  Draws the picture five times, using the five different scaling approaches described in the book. All five look the same, since all are using default (nearest neighbor) filtering during the scale operation.