Question:
Java - Rotating an Image?
asd
2011-04-01 09:42:53 UTC
Hi, I've been searching for a while, but I don't know how to make an image rotate 90 degrees clockwise/counterclockwise at the click of a button. can someone tell what the code is to rotate the image 90 degrees?
Three answers:
anonymous
2011-04-01 10:06:29 UTC
you need to look at java.awt.Graphics2D: http://download.oracle.com/javase/1.4.2/docs/api/java/awt/Graphics2D.html



there is a method called rotate
anonymous
2016-04-14 10:47:24 UTC
I haven't worked with it, but looking at the Graphics2D object, you can set the orientation using the "rotate(double)" method and then call the drawImage(Image, AffineTransform, ImageObserver) method.
Kung Fu Champion
2011-04-01 14:09:50 UTC
Hey, that guy copied my answer from this morning!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



Ya, use the rotate method.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...