public boolean hit(Rectangle rect,Shape s,boolean onStroke){
  if (onStroke) {
    s=stroke.createStrokedShape(s);
  }
  s=transformShape(s);
  if ((constrainX | constrainY) != 0) {
    rect=new Rectangle(rect);
    rect.translate(constrainX,constrainY);
  }
  return s.intersects(rect);
}

public boolean hit ( Rectangle rect , Shape s , boolean onStroke ) { if ( onStroke ) { s = stroke . createStrokedShape ( s ) ; } s = transformShape ( s ) ; if ( ( constrainX | constrainY ) != 0 ) { rect = new Rectangle ( rect ) ; rect . translate ( constrainX , constrainY ) ; } return s . intersects ( rect ) ; }
checks to see if a path intersects the specified rectangle in device space . the rendering attributes taken into account include the clip , transform , and stroke attributes .
