2

I want to know if there is some way to rotate a panel without changing its shape. I mean I am able to rotate the drawings inside the panel using rotate() given in graphics2D but the rectangular drawings become diamond shaped. Is there some soln for it?? I mean can I avoid the drawing from becoming diamond shape. The problem is more evident when u change the resolution of the screen.

mKorbel
  • 109,107
  • 18
  • 130
  • 305
coder
  • 723
  • 2
  • 8
  • 17

1 Answers1

1

Yes, rotate the image around its center, as shown in this example.

Community
  • 1
  • 1
trashgod
  • 200,320
  • 28
  • 229
  • 974
  • but that doesnot seem to help me.. How does first translating and then rotating prevent the rectangular panel from getting deformed. It has to be worked on the resolution.. But I donno how.. – coder Jul 15 '11 at 09:01
  • @trashgod how can we rotate the JPanel control around an angle periodically ? – JAVA May 30 '18 at 09:15
  • @JAVA: As shown [here](https://stackoverflow.com/q/6333464/230513), you can rotate the graphics context, but rotated components are require some additional effort. – trashgod May 30 '18 at 20:38