开发者

JButton vertical text alignment

Hi I am making a project for college for a gallery, I have the re开发者_高级运维ceipt in a JList and want to put some buttons at the side of it but I am picky and want the text on the JButtons to be vertical. At the moment I am using html and putting a <br> in between the letters, this is giving me a really large gap between the letters. Is there a better way of doing this which is reasonably easy. Thanks


One solution is to extend BasicButtonUI to display the text vertically. This tutorial provides sample code overriding BasicButtonUI to simply rotate text either 90 or 270 degrees (text looks like it has been rotated as opposed to reading top to bottom with each character facing the normal way as in a <br />-separated button). To actually paint the text as in

B

u

t

t

o

n

you will need to modify the sample code. The pattern provided is a good place to start.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜