• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help using the AffineTransform class in Java

FrogDog

Diamond Member
I have an image that I want to rotate each time the user presses the left or right arrow key. I'm trying to use AffineTransform for this, but the problem is when I click one of the arrow keys it will only rotate once. Like say I have it set to rotate 15 degrees CCW when I press the left arrow key - well the first time is fine, but then I press it again and it does nothing. Also, when I press the right arrow key after the left one, it doesn't go back to the starting location, it goes 15 CW of it. How should I go about getting around this?
 
Perhaps the AffineTransform takes in an absolute rotation index. So when you say 15 degrees ccw, it means 15 degrees from the ORIGINAL normal. Maybe if you had a static field that maintained the rotation from the original starting point it would work.
 
Back
Top