Skip to main content



      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 12:26 Go to next message
Eclipse UserFriend
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 13:15 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 13:38:48 EDT 2025

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

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

Back to the top