im drawing a witch in Java. I finished up with the body and head but now i want to know how I can rotate a rectangle in Java
As you can see on the image below, I need 2 rectangles rotated with a certain degree to visualise the arms of the witch.
Searched for it, but the solutions where too complicated for this.
//Body
g.setColor(Blue);
g.fillRect(190, 180, 100, 150);
答案 0 :(得分:2)
我认为g是一个Graphic对象,然后
Graphics2D myGraphics2D = (Graphics2D)g;
myGraphics2D.rotate(3.14159); //input in rad... read the doc...