Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rotating Component Contents From Layout Manager

 
Dan Falcone
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a layout manager where I position each new component (JPanels containing images) in the "best fit" position. Sometimes the best fit position is rotated 90 degrees.

There's no problem setting the component's bounds to a rotated position, but how can I communicate back to the calling routine that the image must be rotated within those bounds? Is that possible?

(I'm not clear on all the advantages of LayoutManager2 over LayoutManager but as far as I can tell they don't help here.)

Thanks...

- Dan
 
Dan Falcone
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind - figured it out. I subclassed JPanel to a class called Tile and added a boolean field called "rotated". Then I set rotated from the layout manager and referenced it in the container's paintComponent.

Tried to delete this post once I'd figured it out but couldn't. Sorry for the clutter.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing/etc. forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic