public void filledSquare(double x,double y,double r){
  if (r < 0)   throw new IllegalArgumentException("square side length can't be negative");
  double xs=scaleX(x);
  double ys=scaleY(y);
  double ws=factorX(2 * r);
  double hs=factorY(2 * r);
  if (ws <= 1 && hs <= 1)   pixel(x,y);
 else   offscreen.fill(new Rectangle2D.Double(xs - ws / 2,ys - hs / 2,ws,hs));
  draw();
}

public void filledSquare ( double x , double y , double r ) { if ( r < 0 ) throw new IllegalArgumentException ( "square side length can't be negative" ) ; double xs = scaleX ( x ) ; double ys = scaleY ( y ) ; double ws = factorX ( 2 * r ) ; double hs = factorY ( 2 * r ) ; if ( ws <= 1 && hs <= 1 ) pixel ( x , y ) ; else offscreen . fill ( new Rectangle2D . Double ( xs - ws / 2 , ys - hs / 2 , ws , hs ) ) ; draw ( ) ; }
draws a filled square of side length 2r , centered on ( x , y ) .
