I'm working on a project that we need some vertical buttons. I can render the button so that it looks how it should, but as far as catching mouse events it's still in the area that the button would normally occupy.
Any way to rotate the whole button instead of just the image or change the clickable area?
At a glance, I'd guess you also need to override getPreferred/Maximum/MinimumSize, getSize, getBounds (and any similar methods I may have missed). An easy way would be to transpose and return the Dimension returned by the super implementation. e.g.
luck, db
There are no new questions, but there may be new answers.
Thanks for your reply Darryl. I took what you suggested and it inverted my problem. The clickable area is now where I want it but because the buttons dimensions have changed, the drawing goes back to looking horizontally [attached image]
Additional code:
The other size methods didn't seem to change it any. What you suggested got me thinking though that maybe I should just change the dimensions of the button and figure out how to rotate the associated text. Might be simpler than rotating the whole button. So again thank you for your time and input on this.
I think the best approach is to write a custom ButtonUI that extends the corresponding UI class of the LaF used, as in the first posted link, but as a public class rounded off to provide the functionality needed to be able to set it as the default UI via UIManager.