0
为了绘制和旋转一些图像,我重写了一个Jpanel的paintcomponent,但它具有旋转其他东西的不必要的副作用,例如JLabel添加到JPanel等。我已经尝试在绘制后旋转回来图像但JLabels似乎抖动。Java Swing PaintComponent旋转jlabels
请注意,我在图像中的不同点(不是图像的中心)周围旋转每个图像,因此在图像缓冲区内旋转图像不适合?
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.rotate(Math.toRadians(+(angle)), 137, 188);
g2.drawImage(image1, 125, 131, this);
g2.rotate(Math.toRadians(-(angle)), 137, 188);
g2.rotate(Math.toRadians(+(angle2)), 137, 188);
g2.drawImage(image2, 125, 131, this);
g2.rotate(Math.toRadians(-(angle2)), 137, 188);
}
相关示例见[这里](http://stackoverflow.com/a/3420651/230513)。 – trashgod 2014-12-03 21:58:42