Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to alignment for label text
How to alignment for label text [message #1386138] Fri, 13 June 2014 15:02 Go to next message
Gary Shi is currently offline Gary ShiFriend
Messages: 20
Registered: July 2013
Junior Member
One label was added: org.eclipse.swt.widgets.Label
When plan to do alignment for the text on the label to right,or , center, top, bottom, I am unable to do it. Any idea about it. Or if I can do add some left padding (space), top padding, ...

My code:
public void createPartControl(Composite arg0) {
Label lblNewLabel = new Label(arg0, SWT.NONE);
lblNewLabel.setBounds(25, 99, 400, 26);
lblNewLabel.setText("this is test");
lblNewLabel.setBackground(org.eclipse.wb.swt.SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
lblNewLabel.setFont(org.eclipse.wb.swt.SWTResourceManager.getFont("Tahoma", 6, SWT.TOP));
....
)

How to alignment label text "this is test" to the Right ? In default, it is in left and top alignment when I had big bounds.
Thanks




Appreciate it.Gary
Re: How to alignment for label text [message #1386501 is a reply to message #1386138] Tue, 17 June 2014 23:12 Go to previous message
Eclipse UserFriend
Probably you should do the following lblNewLabel.setAlignment(SWT.RIGHT);
Previous Topic:SIGSEV crash JVM under Ubuntu 12.04 when scrolling in Canvas
Next Topic:Mozilla SWT Browser / Java Native Interface
Goto Forum:
  


Current Time: Fri Apr 26 11:16:48 GMT 2024

Powered by FUDForum. Page generated in 0.03546 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top