How can I rotate an image using Java/Swing and then set its origin to 0,0?

Use the g2d.transform() to shift the image back where it's needed. I'm just imagining what the calculation might be but I think something like.

Use the g2d.transform() to shift the image back where it's needed. I'm just imagining what the calculation might be but I think something like: int diff = ( image.getWidth() - image.getHeight() ) / 2; g2. Transform( -diff, diff ); BTW, you may have a problem with the label reporting its preferred size - you might need to override getPreferredSize() and account for swapping the images width and height if rotated.

AffineTransform trans = new AffineTransform(0.0, 1.0, -1.0, 0.0, image.getHeight(), 0.0); g2d. Transform(trans); g2d. DrawImage(image, 0, 0, image.getWidth(), image.getHeight(), null).

The Rotated Icon class might be what you are looking for.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions