Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Unable to vertically center a Label
Unable to vertically center a Label [message #454286] Tue, 19 April 2005 16:26 Go to next message
Luis is currently offline LuisFriend
Messages: 20
Registered: July 2009
Junior Member
Hi, it's me again with another "unable to..." post ;-).

I can center a Label horizontally by using the SWT.CENTER flag, but I can't
center it vertically.
Is there a way to do so? Or is it a missing feature?

The project I am working at has very specific UI requirements... for
example, they also want to change the color of the table columns, and as far
as I know, this is not supported either (maybe it is not even supported by
the native Windows APIs, who knows).

Any help will be welcome.

Regards,
Luis.
Re: Unable to vertically center a Label [message #454288 is a reply to message #454286] Tue, 19 April 2005 17:15 Go to previous message
Emil Crumhorn is currently offline Emil CrumhornFriend
Messages: 169
Registered: July 2009
Senior Member
Centering a label vertically is not up to the label, but up to the space
that surrounds it. You need to position the label vertically in the
available space.

If you for example use a GridLayout where the height of the space is 100
pixels, and you set the GridData.VERTICAL_ALIGN_CENTER on the LayoutData the
label would be centered vertically in that 100 pixel space. Labels only take
up as much space as they need for the containing text, where you then put it
is up to you.

Emil

"Luis" <lcrespom@gmail.com> wrote in message
news:d43bus$j0p$1@news.eclipse.org...
> Hi, it's me again with another "unable to..." post ;-).
>
> I can center a Label horizontally by using the SWT.CENTER flag, but I
> can't
> center it vertically.
> Is there a way to do so? Or is it a missing feature?
>
> The project I am working at has very specific UI requirements... for
> example, they also want to change the color of the table columns, and as
> far
> as I know, this is not supported either (maybe it is not even supported by
> the native Windows APIs, who knows).
>
> Any help will be welcome.
>
> Regards,
> Luis.
>
>
Previous Topic:Borders not showing on Textfield in Form
Next Topic:Using GC from non-UI thread
Goto Forum:
  


Current Time: Fri Mar 29 14:27:18 GMT 2024

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

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

Back to the top