How do I rotate an image in Java 90 degrees while using the paint Method in JSwing? Here is my code so far, it is not working... transform = transform = new AffineTransform(); transform.rotate(Math.toRadians(45)); //transform.setToScale(.05, .05); File sourceimage = new File("PacMan.png"); try { image = ImageIO.read(sourceimage); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //ImageIcon icon = new ImageIcon(image); transform.rotate(Math.toRadians(90)); g2.drawImage(image, transform, null
How do I rotate an image in Java 90 degrees while using the paint Method in JSwing? Here is my code so far, it is not working... transform = transform = new AffineTransform(); transform.rotate(Math.toRadians(45)); //transform.setToScale(.05, .05); File sourceimage = new File("PacMan.png"); try { image = ImageIO.read(sourceimage); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //ImageIcon icon = new ImageIcon(image); transform.rotate(Math.toRadians(90)); g2.drawImage(image, transform, null
Chapter16: Graphics
Section: Chapter Questions
Problem 17RQ
Related questions
Question
How do I rotate an image in Java 90 degrees while using the paint Method in JSwing? Here is my code so far, it is not working...
transform = transform = new AffineTransform();
transform.rotate(Math.toRadians(45));
//transform.setToScale(.05, .05);
File sourceimage = new File("PacMan.png");
try {
image = ImageIO.read(sourceimage);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//ImageIcon icon = new ImageIcon(image);
transform.rotate(Math.toRadians(90));
g2.drawImage(image, transform, null
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT