This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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.)
Joined: Feb 03, 2009
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.