Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SWT Composite setBackgroundImage() doesn't support transparency?

 
Marcel Urbanek
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to do the following:

A composite with background image contains a composite with a transparent background image which itself contains a label:

composite with background image->composite with transparent background image->label

The idea is, that the label inherits in first place the background of its parent composite, and in second place (where background is transparent) the background of the "root" composite.

But now it looks like SWT can't handle transparent background images for composites. The transparent section is replaced by white color instead of being transparent (at least under windows).

Now this is my question: Do I do something wrong or are transparent background images not supported by SWT? If so, is there a workaround?

Thanks in advance!
 
julien tixador
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I had the same problem, I created my own Icons, so needed a clickable image+text with transparent background. I did this:

http://www.javafr.com/codes/SWT-CUSTOM-FILE-BROWSER_48514.aspx

there are 2 things:
1- shell.setBackgroundMode(SWT.INHERRIT_DFAULT);
to make all childrens hinerit from the shell background

2-Class MyIcon entends Composite{
MyIcon(Composite parent, int style){
super(parent, SWT.TRANSPARENCE_ALPHA);}
}

It's very young but I draw my own Image in a Composite with a transparent background, so I see the background image of my shell.

Hope it can help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic