public static void fillAndDrawRect(Graphics2D gc,double x,double y,double width,double height,double labelAngle,Color fillColor,Color drawColor){
  Dimension theSize=new Dimension((int)Math.round(width),(int)Math.round(height));
  Point2D apt=new Point2D.Float((float)x,(float)y);
  AffineTransform saveTransform=gc.getTransform();
  if (labelAngle >= 0.5 * Math.PI && labelAngle <= 1.5 * Math.PI) {
    apt=Geometry.translateByAngle(apt,labelAngle,theSize.getWidth());
    gc.rotate(Geometry.moduloTwoPI(labelAngle - Math.PI),apt.getX(),apt.getY());
  }
 else {
    gc.rotate(labelAngle,apt.getX(),apt.getY());
  }
  gc.setColor(fillColor);
  gc.fillRect((int)Math.round(apt.getX()),(int)Math.round(apt.getY()) - theSize.height,theSize.width,theSize.height);
  gc.setColor(drawColor);
  gc.drawRect((int)Math.round(apt.getX()),(int)Math.round(apt.getY()) - theSize.height,theSize.width,theSize.height);
  gc.setTransform(saveTransform);
}

public static void fillAndDrawRect ( Graphics2D gc , double x , double y , double width , double height , double labelAngle , Color fillColor , Color drawColor ) { Dimension theSize = new Dimension ( ( int ) Math . round ( width ) , ( int ) Math . round ( height ) ) ; Point2D apt = new Point2D . Float ( ( float ) x , ( float ) y ) ; AffineTransform saveTransform = gc . getTransform ( ) ; if ( labelAngle >= 0.5 * Math . PI && labelAngle <= 1.5 * Math . PI ) { apt = Geometry . translateByAngle ( apt , labelAngle , theSize . getWidth ( ) ) ; gc . rotate ( Geometry . moduloTwoPI ( labelAngle - Math . PI ) , apt . getX ( ) , apt . getY ( ) ) ; } else { gc . rotate ( labelAngle , apt . getX ( ) , apt . getY ( ) ) ; } gc . setColor ( fillColor ) ; gc . fillRect ( ( int ) Math . round ( apt . getX ( ) ) , ( int ) Math . round ( apt . getY ( ) ) - theSize . height , theSize . width , theSize . height ) ; gc . setColor ( drawColor ) ; gc . drawRect ( ( int ) Math . round ( apt . getX ( ) ) , ( int ) Math . round ( apt . getY ( ) ) - theSize . height , theSize . width , theSize . height ) ; gc . setTransform ( saveTransform ) ; }
draw a rectangle at the given anchor point at the given angle ( in radiant )
