Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 22:54 Go to next message
Marc Boorshtein is currently offline Marc BoorshteinFriend
Messages: 24
Registered: July 2009
Junior Member
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 12:42 Go to previous message
Max is currently offline MaxFriend
Messages: 28
Registered: July 2009
Junior Member
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: Sat Apr 20 05:17:48 GMT 2024

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

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

Back to the top