Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How do you set the background image on a Control (in 3.2 M4?)
How do you set the background image on a Control (in 3.2 M4?) [message #467175] Thu, 26 January 2006 04:07
Edward Kuns is currently offline Edward KunsFriend
Messages: 14
Registered: July 2009
Junior Member
The Snippet showing how to set a background image does so on a Shell,
but the method itself belongs to Control. When I try (on WinXP) calling
setBackgroundImage() on a button, it does nothing. If I later call
getBackgroundImage() it does return the correct image, but nothing is
actually drawn.

I've tried this with 3.2M3, 3.2M4, and a recent Integration build of SWT
and this is the same for all of them. It is as if the
setBackgroundImage() call is totally ignored, except that the button
does know what image is supposed to be on its background.

I run Snippet214 and I do get the background image on the Shell, but I
really want a background image on a Button. Here's the issue: I want
text on top of an image. I know that I can roll my own Image with text
on top of an image, and that works, but when I do this and call
setImage() on the button, the image doesn't fill the whole button.
There is a margin around the image inside the button. I would like an
image that fills the entire button, with text on top of that.

I know that I can draw on the GC of the button to put pretty much
anything I want to on the button, but when I have tried this, as soon as
I click on the button, what was on the GC is thrown away. So that
doesn't seem stable on use of the button. Also, the GC occupies not
only the interior of the button, but also the boundaries of the button
that make it a button. I want an image inside the button, but filling
100% of the button.

Is this possible? Any hints and ideas greatly appreciated.

Thanks,

Eddie
Previous Topic:applet embedded in SWT Composite?
Next Topic:How can I create a "Group" with no space for the title?
Goto Forum:
  


Current Time: Mon May 27 06:02:21 GMT 2019

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

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

Back to the top