Java help, can't seem to vertically center this label...

Andvari

Senior member
Jan 22, 2003
612
0
0
I wrote this code and I got this image... but I was supposed to get THIS image instead.

Even when I uncomment out that commented code, it doesn't change the location of the label. Why isn't it centering vertically?
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Well I don't know any Swing but I'll take a stab at it... what if you set the label's vertical text position to CENTER instead of TOP?
 

clamum

Lifer
Feb 13, 2003
26,256
406
126
Try using the BorderLayout manager and putting it in the center region. It's been a year since I did this stuff and my Java book isn't by me so sorry I can't give more info.
 

Andvari

Senior member
Jan 22, 2003
612
0
0
^ I'll give that a shot, but this is homework and I don't think we've covered that yet. We're pretty much supposed to lay it out the way I did, so if there isn't a parameter I'm missing using the classes/methods I've used, it might can't be done.

I *think* the lab instructor said if we can't center it vertically, that's fine. But I wanted to anyway, just to be safe. I would have asked her Wednesday, but lab was canceled due to the hurricane.