that seems logical to me.
Anyways im gonna give a try to what Riven said. When he told me to swap the coords, i was thinking it was going to be a real pain in the a**. God bless the huge libraries Sun created for us, it saves you a lot of mental hassle.
By the way, no one mentioned how to detect which rectangle was clicked. I guess i need to check it for every rectangle on screen (creating a new transform with the current angles for that rectangle and then do the inverse transform for the mouse coords), true?
You can (and for the sake of efficiency, probably should) store the AffineTransform instance, rather than recreate it every time your code is executed in a render or mouse event.
Just by curiosity, when you add an action listener to your swing component, how does swing detect which button was clicked? Does it check the mouse coords with all the components in the canvas, lets say for example, buttons ?
Essencially, yes - though obviously AWT's tree structure reduces the complexity of this search, so it doesn't necessarily have to search the bounding box of every visible component.
One small suggestion - instead of creating a customized Button, I think you'd instead do better to create a customized Container that supports rotation.
That way you will be able to create rotated instances of any component, not just Buttons.
You would also be able to nest rotations, and do all the other funky things a scenegraph-like structure allows.
Ofcourse, this suggestion is only applicable if you are using the AWT/Swing component system for managing these Buttons you are talking about.