Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to put the toolbar text beside the image
How to put the toolbar text beside the image [message #457136] Fri, 17 June 2005 21:49 Go to next message
Damian Biollo is currently offline Damian BiolloFriend
Messages: 19
Registered: July 2009
Junior Member
Hi there,

I have a toolbar with buttons, some of which have text, all of which have
icons.
I would like the text to appear to the left of the image. By default the
text appears below the image.

Is there any way to do this in SWT?


Here's some sample code of how I'm building the toolbar:

ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT);

ToolItem button = new ToolItem (toolbar, SWT.NONE);
button.setText ("MyButton");
button.setToolTipText( "This is my button");
button.setImage (Images.getMyImage());

GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
toolbar.setLayoutData (gridData);

Thanks
Damian
Re: How to put the toolbar text beside the image [message #457165 is a reply to message #457136] Mon, 20 June 2005 13:48 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
The closest you can get is to have your text appear to the right of your
image. To do this create your ToolItems with style SWT.RIGHT.

Grant

"Damian" <damian_biollo@hotmail.com> wrote in message
news:d8vgho$t92$1@news.eclipse.org...
> Hi there,
>
> I have a toolbar with buttons, some of which have text, all of which have
> icons.
> I would like the text to appear to the left of the image. By default the
> text appears below the image.
>
> Is there any way to do this in SWT?
>
>
> Here's some sample code of how I'm building the toolbar:
>
> ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT);
>
> ToolItem button = new ToolItem (toolbar, SWT.NONE);
> button.setText ("MyButton");
> button.setToolTipText( "This is my button");
> button.setImage (Images.getMyImage());
>
> GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
> toolbar.setLayoutData (gridData);
>
> Thanks
> Damian
>
>
Re: How to put the toolbar text beside the image [message #457196 is a reply to message #457165] Mon, 20 June 2005 23:15 Go to previous messageGo to next message
Damian Biollo is currently offline Damian BiolloFriend
Messages: 19
Registered: July 2009
Junior Member
Thanks, SWT.RIGHT worked.

Although, it seemed to be needed in the constructor of the toolbar, rather
than the ToolItem constructor:
ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT |
SWT.RIGHT);


"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:d96hfa$b83$1@news.eclipse.org...
> The closest you can get is to have your text appear to the right of your
> image. To do this create your ToolItems with style SWT.RIGHT.
>
> Grant
>
> "Damian" <damian_biollo@hotmail.com> wrote in message
> news:d8vgho$t92$1@news.eclipse.org...
> > Hi there,
> >
> > I have a toolbar with buttons, some of which have text, all of which
have
> > icons.
> > I would like the text to appear to the left of the image. By default the
> > text appears below the image.
> >
> > Is there any way to do this in SWT?
> >
> >
> > Here's some sample code of how I'm building the toolbar:
> >
> > ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL |
SWT.FLAT);
> >
> > ToolItem button = new ToolItem (toolbar, SWT.NONE);
> > button.setText ("MyButton");
> > button.setToolTipText( "This is my button");
> > button.setImage (Images.getMyImage());
> >
> > GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
> > toolbar.setLayoutData (gridData);
> >
> > Thanks
> > Damian
> >
> >
>
>
Re: How to put the toolbar text beside the image [message #457204 is a reply to message #457196] Tue, 21 June 2005 13:28 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Right, my mistake. It is applied to all items within a ToolBar, not
individual items.

"Damian" <damian_biollo@hotmail.com> wrote in message
news:d97ilo$kuk$1@news.eclipse.org...
> Thanks, SWT.RIGHT worked.
>
> Although, it seemed to be needed in the constructor of the toolbar, rather
> than the ToolItem constructor:
> ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT |
> SWT.RIGHT);
>
>
> "Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
> news:d96hfa$b83$1@news.eclipse.org...
> > The closest you can get is to have your text appear to the right of your
> > image. To do this create your ToolItems with style SWT.RIGHT.
> >
> > Grant
> >
> > "Damian" <damian_biollo@hotmail.com> wrote in message
> > news:d8vgho$t92$1@news.eclipse.org...
> > > Hi there,
> > >
> > > I have a toolbar with buttons, some of which have text, all of which
> have
> > > icons.
> > > I would like the text to appear to the left of the image. By default
the
> > > text appears below the image.
> > >
> > > Is there any way to do this in SWT?
> > >
> > >
> > > Here's some sample code of how I'm building the toolbar:
> > >
> > > ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL |
> SWT.FLAT);
> > >
> > > ToolItem button = new ToolItem (toolbar, SWT.NONE);
> > > button.setText ("MyButton");
> > > button.setToolTipText( "This is my button");
> > > button.setImage (Images.getMyImage());
> > >
> > > GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
> > > toolbar.setLayoutData (gridData);
> > >
> > > Thanks
> > > Damian
> > >
> > >
> >
> >
>
>
Previous Topic:Menu bar changes by OleFrame or OleClientSite
Next Topic:Writing inside one StyleRange and still using it
Goto Forum:
  


Current Time: Sun May 12 05:23:57 GMT 2024

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

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

Back to the top