private static Shape generateDonut(double x,double y,double innerRadius,double outerRadius){
  Area a1=new Area(new Ellipse2D.Double(x,y,outerRadius,outerRadius));
  double innerOffset=(outerRadius - innerRadius) / 2;
  Area a2=new Area(new Ellipse2D.Double(x + innerOffset,y + innerOffset,innerRadius,innerRadius));
  a1.subtract(a2);
  return a1;
}

private static Shape generateDonut ( double x , double y , double innerRadius , double outerRadius ) { Area a1 = new Area ( new Ellipse2D . Double ( x , y , outerRadius , outerRadius ) ) ; double innerOffset = ( outerRadius - innerRadius ) / 2 ; Area a2 = new Area ( new Ellipse2D . Double ( x + innerOffset , y + innerOffset , innerRadius , innerRadius ) ) ; a1 . subtract ( a2 ) ; return a1 ; }
generates a donut shape from the given location and radii by subtracting an inner circular area from an outer one .
