I want to rotate the text present on my JComponent
to vertical, JComponent
also contains border painted in paintComponent
method, I don't want to rotate that border, only text.
I already used graphics2D
rotate
function, but it rotate component border as well, which fails when my component is rectangle.
Please suggest me any approch to rotate only text. This is currently my JComponent :
And what I want :
Actually it's not duplicate. I already used below code:
Graphics2D g2 = (Graphics2D) g;
g2.rotate(Math.PI / 4, bi.getWidth() / 2, bi.getHeight() / 2);
but problem is that, it also rotate border, I don't want that.
All the solutions given are not working, it rotate the border as well. I don't want to rotate the border, only text.
This is what I get after rotate with some angle: