I have a problem in Java. I'm trying to create a 2D shape and rotate it but if I try to rotate it with the Graphics2D's
rotate method, the whole canvas gets rotated.
I would like to only rotate a specific shape, not the whole canvas.
My current render method looks like this:
@Override
public void render(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(super.color);
g2d.rotate(Math.toRadians(5));
g2d.fillRect(100, 100, 50, 50);
}
How should I go about doing this?