What does βrotate text a bitβ mean? What is the purpose of this. When you rotate the text, the top and bottom will be trimmed as you approach the edges of the button.
I think the base code would be something like this:
public void paintComponent(Graphics g) { if (mouseOver) { Graphics2D g2d = (Graphics2D)g; g2d.rotate(...); super.paintComponent(g2d); g2d.rotate(...); } else super.paintComponent(g); }
Instead of rotating, the best solution is perhaps to shift the text up / down a couple of pixels, then you do not need to worry about truncation. The main code should be the same, but you would use the translate (...) method.
source share