Center text in a JLabel?
From: willy (willyb_at_waonka.net)
Date: 12/30/03
- Next message: Andrew Jackman: "Re: [Swing] Controlling depth of multiple JWindows."
- Previous message: Jim Sculley: "Re: Pedantic Swing threading question"
- Next in thread: Knute Johnson: "Re: Center text in a JLabel?"
- Reply: Knute Johnson: "Re: Center text in a JLabel?"
- Reply: VisionSet: "Re: Center text in a JLabel?"
- Reply: Andrew Thompson: "Re: Center text in a JLabel?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Dec 2003 23:19:40 GMT
Hi,
I'm not sure what I'm missing here, but I can't get my text to center in a
JLabel:
Note my 2 different attempts...
JLabel statusPane = new JLabel( );
// this doesn't work?
//statusPane.setAlignmentX( JLabel.CENTER_ALIGNMENT );
// this doesn't work?
statusPane.setHorizontalTextPosition( SwingConstants.CENTER );
statusPane.setBackground( new Color( 0x00aa00 ) );
statusPane.setOpaque( true );
statusPane.setText( "STATUS" );
Thanks for any tips.
T-
- Next message: Andrew Jackman: "Re: [Swing] Controlling depth of multiple JWindows."
- Previous message: Jim Sculley: "Re: Pedantic Swing threading question"
- Next in thread: Knute Johnson: "Re: Center text in a JLabel?"
- Reply: Knute Johnson: "Re: Center text in a JLabel?"
- Reply: VisionSet: "Re: Center text in a JLabel?"
- Reply: Andrew Thompson: "Re: Center text in a JLabel?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]