#1140 Overlapping text and images on a widget?

casey Thu 8 Jul 2010

I'm wondering how, if possible, I could overlap the text with an image I'm using on a button. I think this would be a better option since I may use the same image for all the buttons and making several images would be wasteful. Can anyone help?

andy Thu 8 Jul 2010

You mean overlap directly on top of each other - like a background image? And FYI - there is not a cost to reusing the same image in your UI. Give me a few more details, and I can point you in the right direction.

casey Thu 8 Jul 2010

Yes, the button will have a generic image and then text laid over the image. I know there isn't an issue reusing the same image - I was actually referring to having to make multiple images with the text directly on them if overlapping is not possible.

Currently, the text and image of the button just end up side-by-side (However, I haven't set the preferred size of the button yet, so that may be part of the issue).

andy Thu 8 Jul 2010

Oh, yeah I'm not sure SWT supports that or not - if it does tho, we can look at adding that. Other options include using Canvas to roll your own buttons, or layering a few widgets in a BorderPane as custom buttons.

Login or Signup to reply.