米琪卡哇伊
一种简单的方法,而无需使用如此复杂的draw语句: //Make a backup so that we can reset our graphics object after using it. AffineTransform backup = g2d.getTransform(); //rx is the x coordinate for rotation, ry is the y coordinate for rotation, and angle //is the angle to rotate the image. If you want to rotate around the center of an image, //use the image's center x and y coordinates for rx and ry. AffineTransform a = AffineTransform.getRotateInstance(angle, rx, ry); //Set our Graphics2D object to the transform g2d.setTransform(a); //Draw our image like normal g2d.drawImage(image, x, y, null); //Reset our graphics object so we can draw with it again. g2d.setTransform(backup);