getting the shape to center at mouse coordinates
i am having a hard time getting this right.. i can rotate the rectangle but i can't make it move to the center of the mouse.. here's the code
privatevoid drawTempStructure(Graphics2D g2D)
{
Rectangle2D.Double rect =new Rectangle2D.Double();
Point2D.Double structCenter =new Point2D.Double();
Point2D.Double shapeCenter =new Point2D.Double();
Shape shape;
double theta = Math.toRadians(45);
Rectangle2D bounds;
structCenter.setLocation(mouseX, mouseY);
AffineTransform at = AffineTransform.getRotateInstance(theta, structCenter.getX(), structCenter.getY());
rect.setRect(structCenter.getX(), structCenter.getY(), structWidth, structHeight);
shape = at.createTransformedShape(rect);
bounds = shape.getBounds2D();
at.setToTranslation(bounds.getCenterX(), bounds.getCenterY());
g2D.draw(shape);
}
mouseX and mouseY are the coordinates of the mouse

