Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Button Image on Windows shows background color instead of appearing transparent
Button Image on Windows shows background color instead of appearing transparent [message #447881] Mon, 20 December 2004 17:54 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Virtual TableTreeViewer
Next Topic:How to launch a java program (having swt comp) in browser
Goto Forum:
  


Current Time: Sun Jul 13 18:16:32 EDT 2025

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

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

Back to the top