aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Rotating Component Contents From Layout Manager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Rotating Component Contents From Layout Manager" Watch "Rotating Component Contents From Layout Manager" New topic
Author

Rotating Component Contents From Layout Manager

Dan Falcone
Greenhorn

Joined: Feb 03, 2009
Posts: 8
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

Joined: Feb 03, 2009
Posts: 8
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

Joined: Sep 29, 2008
Posts: 12617

Moving to Swing/etc. forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rotating Component Contents From Layout Manager