Quick Java Question -- How to make a JLabel's text Run Vertically?

statik213

Golden Member
Oct 31, 2004
1,654
0
0
^^^^
should be easy.... feel sheepish asking this here... but can't see anything in the JLabel API that would do this.
Googling didnt help either.....
Seems like something that should be easy to do....
 

znaps

Senior member
Jan 15, 2004
414
0
0
I think you need to override the paintComponent() method to rotate 90/270 degrees and call drawString() to paint your label text.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Hmm.. woudl that mess up how the `JVerticalLabel; calculcates its dimensions? I'd like this to function like any other Component with the regular layout manager
 

znaps

Senior member
Jan 15, 2004
414
0
0
You're welcome..that solution is a more fleshed out version of what I suggested.