question: private void drawZoomRectangle ( Graphics2D g2 , boolean xor ) { Rectangle2D zoomRectangle = ( Rectangle2D ) getChartFieldValueByName ( "zoomRectangle" ) ; if ( zoomRectangle != null ) { zoomRectangle = coordinateTransformation . transformRectangle ( zoomRectangle , this ) ; if ( ! ( coordinateTransformation instanceof NullCoordinateTransformation ) ) { g2 = coordinateTransformation . getTransformedGraphics ( this ) ; } if ( xor ) { g2 . setXORMode ( Color . gray ) ; } if ( ( Boolean ) getChartFieldValueByName ( "fillZoomRectangle" ) ) { g2 . setPaint ( ( Paint ) getChartFieldValueByName ( "zoomFillPaint" ) ) ; g2 . fill ( zoomRectangle ) ; } else { g2 . setPaint ( ( Paint ) getChartFieldValueByName ( "zoomOutlinePaint" ) ) ; g2 . draw ( zoomRectangle ) ; } if ( xor ) { g2 . setPaintMode ( ) ; } } }
target:  Draws zoom rectangle (if present). The drawing is performed in XOR mode, therefore when this method is called twice in a row, the second call will completely restore the state of the canvas.