Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Vertical alignment in label; Preferred size of label
Vertical alignment in label; Preferred size of label [message #458248] Mon, 11 July 2005 23:16 Go to next message
Arun is currently offline ArunFriend
Messages: 61
Registered: July 2009
Member
Hi

I am trying to get text aligned vertically on a label.
But not able to find any option for this.

I also want to set an aolsute height for the label.
Currently the label height is the same as that of the text within it.
have tried invoking label.setpreferredHeight(), but does not seem to work.

Any pointers are appreciated.
Thanks in advance

Arun
Re: Vertical alignment in label; Preferred size of label [message #458268 is a reply to message #458248] Tue, 12 July 2005 14:15 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Believe it or not, aligning a label vertically is not supported on all
operating systems. If you want to do this in SWT, align the label in it's
parent using a layout or by calling setBounds() on the label when the parent
is resized.

If you want to set the bounds of any control, including labels, use
setBounds(). Note that when a control is a child of a composite that
includes a layout, the layout will almost certainly override and setBounds()
call that you make as part of the layout algorithm.

Hope this helps.

"Arun" <jacob.arun@gmail.com> wrote in message
news:2cf406068266d2b959efe1b46b0bf5df$1@www.eclipse.org...
> Hi
>
> I am trying to get text aligned vertically on a label.
> But not able to find any option for this.
>
> I also want to set an aolsute height for the label.
> Currently the label height is the same as that of the text within it.
> have tried invoking label.setpreferredHeight(), but does not seem to work.
>
> Any pointers are appreciated.
> Thanks in advance
>
> Arun
>
Re: Vertical alignment in label; Preferred size of label [message #458273 is a reply to message #458268] Tue, 12 July 2005 15:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jacob.arun.gmail.com

Hi

By vertical alignment, I meant th alignment of text inside the label,
instead of alignment of the label within its parent.

As attched in this (label_buttons.jpg), I have 4 labels, which I use as
buttons as SWT button foreground and background cannot be customised. The
problem is that the text in one 1 of the 4 labels wraps. Due tp the layout
the height of all 4 lbels also double. But the text in the labels with
non-wrapping text does not align centrally vertically.


Thanks in advance
Arun


"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:db0j9g$d0d$1@news.eclipse.org...
> Believe it or not, aligning a label vertically is not supported on all
> operating systems. If you want to do this in SWT, align the label in it's
> parent using a layout or by calling setBounds() on the label when the
parent
> is resized.
>
> If you want to set the bounds of any control, including labels, use
> setBounds(). Note that when a control is a child of a composite that
> includes a layout, the layout will almost certainly override and
setBounds()
> call that you make as part of the layout algorithm.
>
> Hope this helps.
>
> "Arun" <jacob.arun@gmail.com> wrote in message
> news:2cf406068266d2b959efe1b46b0bf5df$1@www.eclipse.org...
> > Hi
> >
> > I am trying to get text aligned vertically on a label.
> > But not able to find any option for this.
> >
> > I also want to set an aolsute height for the label.
> > Currently the label height is the same as that of the text within it.
> > have tried invoking label.setpreferredHeight(), but does not seem to
work.
> >
> > Any pointers are appreciated.
> > Thanks in advance
> >
> > Arun
> >
>
>



Re: Vertical alignment in label; Preferred size of label [message #458520 is a reply to message #458273] Thu, 14 July 2005 13:41 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You will need to provide code.

"Arun Jacob" <jacob.arun@gmail.com> wrote in message
news:db0m1e$h6b$1@news.eclipse.org...
> Hi
>
> By vertical alignment, I meant th alignment of text inside the label,
> instead of alignment of the label within its parent.
>
> As attched in this (label_buttons.jpg), I have 4 labels, which I use as
> buttons as SWT button foreground and background cannot be customised. The
> problem is that the text in one 1 of the 4 labels wraps. Due tp the layout
> the height of all 4 lbels also double. But the text in the labels with
> non-wrapping text does not align centrally vertically.
>
>
> Thanks in advance
> Arun
>
>
> "Steve Northover" <steve_northover@ca.ibm.com> wrote in message
> news:db0j9g$d0d$1@news.eclipse.org...
> > Believe it or not, aligning a label vertically is not supported on all
> > operating systems. If you want to do this in SWT, align the label in
it's
> > parent using a layout or by calling setBounds() on the label when the
> parent
> > is resized.
> >
> > If you want to set the bounds of any control, including labels, use
> > setBounds(). Note that when a control is a child of a composite that
> > includes a layout, the layout will almost certainly override and
> setBounds()
> > call that you make as part of the layout algorithm.
> >
> > Hope this helps.
> >
> > "Arun" <jacob.arun@gmail.com> wrote in message
> > news:2cf406068266d2b959efe1b46b0bf5df$1@www.eclipse.org...
> > > Hi
> > >
> > > I am trying to get text aligned vertically on a label.
> > > But not able to find any option for this.
> > >
> > > I also want to set an aolsute height for the label.
> > > Currently the label height is the same as that of the text within it.
> > > have tried invoking label.setpreferredHeight(), but does not seem to
> work.
> > >
> > > Any pointers are appreciated.
> > > Thanks in advance
> > >
> > > Arun
> > >
> >
> >
>
>
>
>
Previous Topic:Opaque Canvas
Next Topic:Dynamic Buttons in Wizard Pages
Goto Forum:
  


Current Time: Tue Apr 23 17:15:14 GMT 2024

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

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

Back to the top