Button Image on Windows shows background color instead of appearing transparent [message #447881] |
Mon, 20 December 2004 17:54  |
Eclipse User |
|
|
|
Hello,
I have an SWT application which uses images on buttons (using the
setImage() method). These button images are straight from the eclipse
distro. When used in menus or coolbars, the image is transparent. But
when in a button (on windows only, mac and gtk appear to work fine) the
image has a white background. Am I missing something? Does something
need to be done to ensure that the button's image displays properly?
Thanks
Marc Boorshtein
|
|
|
Re: Button Image on Windows shows background color instead of appearing transparent [message #448416 is a reply to message #447881] |
Sun, 09 January 2005 07:42  |
Eclipse User |
|
|
|
In article <cq7l72$bcn$1@www.eclipse.org>,
marc.boorshtein@octetstring.com says...
> I have an SWT application which uses images on buttons (using the
> setImage() method). These button images are straight from the eclipse
> distro. When used in menus or coolbars, the image is transparent. But
> when in a button (on windows only, mac and gtk appear to work fine) the
> image has a white background. Am I missing something? Does something
> need to be done to ensure that the button's image displays properly?
Snip from SWT javadoc for Image:
setBackground
public void setBackground(Color color)
Sets the color to which to map the transparent pixel.
There are certain uses of Images that do not support transparency (for
example, setting an image into a button or label). In these cases, it
may be desired to simulate transparency by using the background color of
the widget to paint the transparent pixels of the image. This method
specifies the color that will be used in these cases. For example:
Button b = new Button();
image.setBackground(b.getBackground());
b.setImage(image);
--
Regards Max rotvel AT bolignet-aarhus DOT dk
|
|
|
Powered by
FUDForum. Page generated in 0.03412 seconds