private void drawSelectionRectangle(Graphics2D g2){
  if (this.selectionRectangle != null) {
    if (this.fillSelectionRectangle) {
      g2.setPaint(this.selectionFillPaint);
      g2.fill(selectionRectangle);
    }
 else {
      g2.setPaint(this.selectionOutlinePaint);
      g2.draw(selectionRectangle);
    }
  }
}

private void drawSelectionRectangle ( Graphics2D g2 ) { if ( this . selectionRectangle != null ) { if ( this . fillSelectionRectangle ) { g2 . setPaint ( this . selectionFillPaint ) ; g2 . fill ( selectionRectangle ) ; } else { g2 . setPaint ( this . selectionOutlinePaint ) ; g2 . draw ( selectionRectangle ) ; } } }
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 .
