aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Alignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Alignment" Watch "Alignment" New topic
Author

Alignment

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
I have a JLabel that gets added to a JPanel that eventually gets added into a bunch of nested JPanels and such. When it displays the JLabel's text appears to be centered and (because the text spans beyond the display area) both the front and the end of the text gets cut off from display (only middle of text is displayed). What is the best method to ensure the JLabel is not centered but rather display left to the right (front of string is shown but right is cut off only). Thanks in advance.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
what layoutManager is used by the label's container panel?
(coule be an 'absolute positioning' issue)
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
I'm pretty certain the JPanel holding the JLabel is using the default manager and the panel it's nested within is using FlowLayout. I don't have the code right in front of me at the moment, sorry.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> I'm pretty certain the JPanel holding the JLabel is using the default manager and the panel it's nested within is using FlowLayout.

to have the left side showing, right side cut off, change
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
FlowLayout has a left static constant? I didn't know that, thanks. I ended up using BorderLayout with WEST set and seems to do the trick. Thanks for the info. Appreciate it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alignment